Support » Fixing WordPress » Posting featured images by page id

  • Resolved AlyssaMc


    I am trying to display the featured images of certain pages of my website on my homepage, which I want to call by page id. I can figure out how to do this for my recent posts, etc., but I want to call the featured images from only a few of my pages (not posts).

    I’ve tried fiddling with the following for a while, but I can’t seem to get it to work:

    	$page_id = 144;
    	$my_page = get_page( $page_id );
    	if( $my_page )
    	foreach( $my_page as $my_post ) : setup_postdata( $my_post );

    Any thoughts?

Viewing 1 replies (of 1 total)
  • AlyssaMc


    Nevermind, I got it. In case you’re interested:

    $the_query = new WP_QUERY ( 'page_id=144' );
    while ( $the_query->have_posts() ) :
Viewing 1 replies (of 1 total)
  • The topic ‘Posting featured images by page id’ is closed to new replies.