Genesis Simple Hooks Display Featured Image on Pages Only

I'm trying to get the featured image to show above the page content and below the navigation. I've gotten it to work but it is pulling the featured image from both pages and posts. I only want it to pull on pages (not posts).

Here is the code I'm using:

<?php
genesis_image(
array(
'format' => 'html',
'size' => 'full',
'num' => 0,
'attr' => array( 'class' => 'feature' )
)
);
?>

I'm not sure how to make it work. I'm thinking maybe using the page ID #s but I don't know where I would put that. Changing the 'num' => 0 from 0 to page ID# breaks it.

I'm using the Dynamik Genesis child theme on a test URL I play around with. Here's an example of a page where it works. http://wordthis.com/about-word-this/

Any ideas how to make it work on pages only...not posts? Thanks!

  • Ash
    • WordPress Hacker

    Hello @eslucky

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    In which file you are using this code? I think the codes need to be in page.php but not in single.php

    Please let us know.

    Cheers
    Ash

  • eslucky
    • Flash Drive

    Thanks Ashok!

    I'm using it with the Genesis Simple Hooks plugin in the Content Hooks genesis_before_content_sidebar_wrap

    Makes sense to use it in the page.php file but, to by honest, I'm not sure where to find that using the Dynamik site builder. I don't even see it via ftp.

  • eslucky
    • Flash Drive

    In case anyone wants to know, I got it fixed with help from the Live Support (thank you). Here's what I used:

    <?php
    if( is_page() ) {
    genesis_image(
    array(
    'format' => 'html',
    'size' => 'full',
    'num' => 0,
    'attr' => array( 'class' => 'feature' )
    )
    );
    }
    ?>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.