I am using wordpress for my next CMS project. Say I have a page template (full width page template) but the pages under that template have certain parts that are in one page but not in another . I am not talking about the content, the content comes from wordpress. I am talking about some specific parts of pages (say some images) which may be in one page but not in another . However the pages are under the same template.
I could accomplish it by creating separate templates for every such page, but that wont be appropriate.
In my last template, I used the ID of the current page/post to hide and display such contents for those particular pages/posts, But when the page is deleted and added again, all of my code would be meaningless because my code couldnot match the new ID.
I was thinking about doing it by matching the name of the page instead of ID, but when I use the_title() to compare, it displays the title because the nature of the_title() function is to display the title. How can I use it to compare the title?
if(the_title() == "home"){
//show the content for home page
}
Is there any other appropriate way to accomplish the thing that I want ??
Use
get_the_titleinstead: