[resolved] Add content of a "Pages" page to a div in my template (5 posts)

  1. drumnation
    Posted 4 years ago #

    Hi I'm new to WordPress and still finding my way around. I've created a html mockup of the illustrator site in divs with css and now I want to add the content dynamically.

    First off I chose to put the positioning statement text in a "pages" page rather than a post. I've been reading through the docs and can't seem to find the template tag I'm looking for. Any help would be much appreciated.


  2. s_ha_dum
    Posted 4 years ago #


    I don't think I know what you are talking about. Based on your description, I am very confused.

  3. CounterDax
    Posted 4 years ago #

    So, I believe you want to grab the content of a page and output it in a certain location? This is possible by creating a new WP-Query class, but this does mean you're making an extra database request, so use sparingly.

    // Create second WordPress loop
    $page_content = new WP_Query( 'pagename=page-slug' );
    while( $page_content->have_posts() ) : $page_content->the_post();
    	// Your content output goes here
    	echo '<h2>';
    	echo '</h2>';
    // Don't forget to reset the post data!

    Also see the codex entry of WP_Query

  4. drumnation
    Posted 4 years ago #

    Worked perfectly. Thank you.

  5. drumnation
    Posted 4 years ago #

    Where it says new WP_Query( 'pagename=page-slug' );
    I put WP_Query( 'page_id=8' );

    That's all I needed to call up a particular page. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic