PHP condition to make content visible/invisible

Does Theme X support showing content based on location? Which means, can I only show some sections, if the currently visible page is the index (start page)? Can you provide me with a PHP if-else condition to achieve that?

For example:
If I add a div-section to template 6 (no container, no header, no footer), how can I only make this visible on the default blog start page? But not visible, if the user is visiting any other page like the article/post etc…

Hello @airdelicious,

Thanks for asking. :slight_smile:

Absolutely. X theme is flexible and it’s developed as a framework so that users can make necessary changes as per requirement. What you are looking can be achieved using WordPress conditional statements. Essentially before a code executes, is will have to pass on few conditions. So let’s say if you want to run a script only on homepage or blog page, just use conditional tags. I am sharing few link that will help you get started:

https://codex.wordpress.org/Conditional_Tags


Thanks.

1 Like