WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Displaying Articles of Category AND page Description (7 posts)

  1. kreps
    Member
    Posted 4 years ago #

    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?

  2. keesiemeijer
    moderator
    Posted 4 years ago #

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

    <?php echo category_description(3); ?>
  3. kreps
    Member
    Posted 4 years ago #

    By description I mean the description of the static page.

  4. keesiemeijer
    moderator
    Posted 4 years ago #

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

  5. kreps
    Member
    Posted 4 years ago #

    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 :-)

  6. keesiemeijer
    moderator
    Posted 4 years ago #

    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;
     ?>
  7. kreps
    Member
    Posted 4 years ago #

    thanks, that worked fine for me!

Topic Closed

This topic has been closed to new replies.

About this Topic