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

I have to get specific page content (like page(12))

I used that :

  <?php $id=47; $post = get_page($id); echo $post->post_content;  ?>

Work nice execpt for compatibility with qtranslate it return french and english text

But the loop is fine, return only the good language version

<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div id="post">
<?php the_content(); ?>
</div> <!-- .post -->

So the question.... HOW to get a specific page content insite the loop...

share|improve this question
This was very helpful! Thanks! I had a hard time looking for what I thought was a simple request. – user14395 Mar 21 '12 at 22:14

Just to clarify:

You mixed two things here. qTranslate stores the different languages in the same post. If you call get_content(), $post->content or an other direct query, you will get the whole content with all different languages from the database.

What qTranslates do, it creates a filter-hook which is attached to the_content hook. If somebody call the_content() in a page template, all other languages will be filtered out.

So you're right. To filter the other languages, you have to apply the filter-hook the_content to your output.

share|improve this answer
up vote 5 down vote accepted

Here is the solution i have founs that work fine...the codex should be more specific about the apply_filter ... used it all everytime

$post = get_page($id);
$content = apply_filters('the_content', $post->post_content);
echo $content;

But i have found a great place to ask question (HERE)! thanks guys !

share|improve this answer

You can use get_page, like so:


share|improve this answer

It's not used often, but myself I like get_post_field() function. It is compact, yet flexible for when you need to pull single specific field.

share|improve this answer

protected by Community Jun 20 '14 at 13:45

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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