WordPress.org

Support

Support » Themes and Templates » PAGE excerpt in widget area?

PAGE excerpt in widget area?

  • Hey guys!
    I’ve got a problem that I can’t figure out…
    I’ve added the “add_post_type_support( ‘page’, ‘excerpt’ );” to my functions.php file in order to get the possibility to write excerpts for pages. That’s working fine…

    However, I want to get the title, thumbnail and excerpt from a specific page to show up in a div/widget area on my homepage. So far I’ve got it working with the thumbnail and title, but I can’t get the excerpt working..!

    I’ve tried all kinds of code after googleing. Here’s how it curruntly looks:

    <?php echo get_the_post_thumbnail( $page_id = 5 ); ?>
    <?php echo get_the_title( $page_id = 5 ); ?>
    <?php echo the_excerpt( $page_id = 5 ); ?>

    Thanks in advance for any hints/tips!
    /Nick

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
        $page_id = 5;
        $page_data = get_page( $page_id );
        echo get_the_post_thumbnail( $page_id );
        echo $page_data->post_title;
        echo $page_data->post_excerpt;
    ?>

    Amazing!

    That gave me the thumbnail and the excerpt, but the post/page-title disappeared instead… Any idea why?

    Muchas gracis Andrei!

    Frankly, I don’t know. It should work and it does work here. Weird.
    You could try get_the_title instead.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PAGE excerpt in widget area?’ is closed to new replies.
Skip to toolbar