WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] page_data->get_the_post_thumbnail (3 posts)

  1. Cas
    Member
    Posted 1 year ago #

    Hello!

    I am creating a One page Design in WordPress. I can include the page content and title in the index with the following code:

    <div id="column3"><!-- Start Column3 -->
                            <?php
    						$page_id = 5;
    						$page_data = get_page( $page_id );
    						?>
                            <h2><?php echo $page_data->post_title; ?></h2>
                            <?php echo $page_data->get_the_post_thumbnail; ?>
                            <p><?php echo $page_data->post_content; ?></p>
                        </div><!-- End Column3 -->

    Only, the featured image doesn't get loaded in. Is there another method to make it work?

    I've added the following code into my Functions.php:

    <?php
    add_theme_support('post-thumbnails', array('page'));
    ?>
  2. flashbuddy
    Member
    Posted 1 year ago #

  3. Cas
    Member
    Posted 1 year ago #

    Thanks @flashbuddy

    I tried that method before but i typed something wrong :p It worked!

Topic Closed

This topic has been closed to new replies.

About this Topic