When working with Genesis hooks and filters, you don’t always want your customizations to take effect across your whole site. Sometimes you only want them to take effect under certain circumstances, such as:
- on Posts, but not on Pages
- on Pages, but not on Posts
- on single Posts and Pages, but not in archives
- in archives, but not on single Posts and Pages
- only on the front page
- only for certain categories or tags
and the list goes on.
Here is an example. The code below uses the function
genesis_image to output the featured image and the hook
genesis_entry_content to position it directly below the entry content. Due to the presence of the conditional tag
is_page, it will only take effect for Pages. Posts, on the other hand, will get no featured image.
You can install this code (or other code like it) on your Genesis site by adding it to your theme functions.
Genesis Simple Hooks
You can also use conditional tags with Genesis Simple Hooks. Just make sure to select Execute PHP. See below.
Relevant tutorials from the Genesis community.