1

I created a Page called "About Joe" as a page in WordPress.

Then on a different page (e.g. the homepage), I wish to display a summary which includes:

  1. a thumbnail
  2. the 1st paragraph
  3. link to page

Is this possible?

Maybe I'm not asking the right questions to the codex as I'm not finding anything.

The closest thing I could find was get_page(), which i'm not even sure is the solution.

But that function is now deprecated.

Please advise!

Thanks

  • OK. WP_Query looks like where I need to be. Checking... – sleeper May 15 '14 at 5:43
  • yep. WP_Query does just what i'm looking for (mostly). – sleeper May 15 '14 at 5:55
  • What do you mean by mostly – Pieter Goosen May 15 '14 at 6:49
1

Use $post = get_post( id ); and then set the post like setup_postdata($post); and you can call the_content(); or the_excerpt();

  • To reset the postdata use wp_reset_postdata(); – pascalvgemert May 15 '14 at 10:27
0

Update: No more working tired! Completely forgot about WP_Query. Here is what I came up with...

<?php
    $args = array (
        'page_id'             => '1265',
        'post_type'           => 'Page',
        'post_status'         => 'published',
        'posts_per_page'      => '1',
        'ignore_sticky_posts' => true,
    );

    // The Query
    $fa_query = new WP_Query( $args );
?>

<?php if ( $fa_query->have_posts() ) : while ( $fa_query->have_posts() ) : $fa_query->the_post(); ?>
    // do something
<?php endwhile; else : ?>
    // Nothing to see
<?php endif; ?>                     
<?php wp_reset_postdata(); ?> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.