WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Displaying Articles of Category AND page Description

[Resolved] Displaying Articles of Category AND page Description

  • Hi,

    I’ve got a static page in WordPress with an Description. This page lists all articles of a category (by using query_posts(‘test’) in a template. How can I show the description of the page also? If I modify the query_post and append “&page_id=7” after “test” it doesen’t work.

    The description of the page should be showed above the articles.

    Is there a possibility to solve that problem?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator keesiemeijer

    @keesiemeijer

    By description you mean the description of the category?
    For that you could use category_description:

    <?php echo category_description(3); ?>

    By description I mean the description of the static page.

    Moderator keesiemeijer

    @keesiemeijer

    Pages don’t have descriptions. How did you give that Page a discription (plugin, custom fields)?

    OK, maybe theres another name for the text I’ve typed for the static page.

    The “text” of the page I want to display is in the backend at “page” > “page” then I’ve selected my page in the list > below the title of a site is the edit field (with the formatting options), where I’ve typed my text.

    Sorry I’ve the mentioned terms doesen’t match exactly but I’ve switched the language in my backend to german and translated as good as possible 🙂

    Moderator keesiemeijer

    @keesiemeijer

    You don’t have a loop for the page itself only for the category.

    Look at the loop you have for the (category) page and copy this loop without the query_posts('test') . Put this loop above your category loop.

    the loop looks something like this (depending on your theme):

    <?php if (have_posts()) : while (have_posts()) : the_post();?>
     <div class="post">
      <h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2>
      <div class="entrytext">
       <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
      </div>
     </div>
     <?php endwhile;  // end of loop
           endif;
     ?>

    thanks, that worked fine for me!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Displaying Articles of Category AND page Description’ is closed to new replies.
Skip to toolbar