Support Forum

[Other] Featured image each page

Home Forums rtPanel – WordPress Theme Framework [Other] Featured image each page

This topic contains 4 replies, has 2 voices, and was last updated by nestrosu 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #63460

    nestrosu
    Participant

    How to show featured image above each single post page (not home page)

    #63466

    Hello Nestrosu,

    Add following code in your functions.php file,

    function rtp_single_post_thumb() {
        if ( ( ! is_home() || ! is_front_page() ) && ( is_singular() && has_post_thumbnail() ) ) {
            echo '<figure class="rtp-singular-thumbnail">';
            the_post_thumbnail( 'full' );
            echo '</figure>';
        }
    }
    
    add_action( 'rtp_hook_begin_post_content', 'rtp_single_post_thumb' );
    

    In above code, is_singular() will check if current page is single post or single page and the_post_thumbnail() function will display featured image on single post OR page.

    #63473

    nestrosu
    Participant

    Awesome it works .. thank you

    #63537

    Glad to know it works for you.

    Thanks for using rtPanel :)

    #63538

    nestrosu
    Participant

    rtpanel is something i was looking for a long time .. also thank you guys for creating this awesome framework

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

People Who Like Thisx

Loading...