Forum Moderators: coopster

Message Too Old, No Replies

Show Hook/Function ONLY on Posts - Not pages

Anyone familiar with Wordpress?

         

naitsirch26

5:09 am on Nov 11, 2009 (gmt 0)

10+ Year Member



If you're familiar with Wordpress, it would be very helpful. I'm also using the Thesis theme.

I have the following hook/code that I'm trying to display ONLY on post type pages. Currently, with the current rendition of this code - it shows the hook on posts, pages AND the home page. I just want it to show up on the posts. Is there a variable and if statement I can use to fix this? Thanks!

<?php function custom_ad1() { ?>
code here
<?php }
add_action('thesis_hook_after_post', 'custom_ad1', '1');
?>

tomda

5:54 am on Nov 11, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use the is_page core Wordpress function.

<?php function custom_ad1() { ?>
code here
<?php }
if(is_page()) {
add_action('thesis_hook_after_post', 'custom_ad1', '1');
}
?>
Look at this - codex.wordpress.org/Conditional_Tags

naitsirch26

6:09 am on Nov 11, 2009 (gmt 0)

10+ Year Member



Thank you very much. I got it working and fixed using your thoughts, along with an OpenHook plugin. Worked like a charm.