drumnation
Member
Posted 1 year 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.
-Dave
Dave,
I don't think I know what you are talking about. Based on your description, I am very confused.
CounterDax
Member
Posted 1 year 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.
<?php
// 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>';
the_title();
echo '</h2>';
the_content();
endwhile;
// Don't forget to reset the post data!
wp_reset_postdata();
?>
Also see the codex entry of WP_Query
drumnation
Member
Posted 1 year ago #
Worked perfectly. Thank you.
drumnation
Member
Posted 1 year 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.