Support » Themes and Templates » Add content of a "Pages" page to a div in my template

  • Resolved drumnation


    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.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Dave,

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

    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

    Worked perfectly. Thank you.

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add content of a "Pages" page to a div in my template’ is closed to new replies.