WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Absolute beginner question: I need to load text into specific div tags across the page. On my html mockup its a lorem ispum text box waiting for wordpress to load the real content. So, how do i control the real content and its relation with the div box text on the page? Can it be a post, so i can manage it from the dashboard? Thanks in advance.

share|improve this question
up vote 1 down vote accepted

You can solve this in different ways.

One it's to use simple querys with WP_Query and using the p parameter to retrive a particular post like it's explained here. Something like this:

$the_query = new WP_Query( 'p=123' );
while ( $the_query->have_posts() ) : $the_query->the_post();

Where 123 it's the post id from where you need the data (the_content).

Or you can query the content from a single post using get_post function. Like this:

$postid = 123;
$queryp = get_post($postid);
$content = $queryp->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;

Where 123, again, it's the postid from where you need to extract the content.

And i think wp_get_single_post function should work too.

Then you can control your content everywhere just extracting the desired data from certains posts by postid

share|improve this answer
Thanks for the quick reply, TCattd. I'm not sure about where to put the code(which page, which part) but I'll give it a try. Thx again. – luprates Mar 12 '12 at 15:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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