Loop for posts in pages (11 posts)

  1. suedkind
    Posted 11 years ago #

    I've working on a template for pages. This template should contain a loop which lists only posts.
    But the loop gives pages back but no posts.
    Any ideas

    Example code:
    <?php rewind_posts(); ?>
    <?php // query_posts('category_name=filmtip&showposts=6'); ?>

      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    • <?php the_title(); ?>
      <?php the_time('d.m.Y',display); ?> ">mehr
    • <?php endwhile; else: ?>

    • <?php _e('Keine aktuellen Meldungen'); ?>
    • <?php endif; ?>

  2. Kafkaesqui

    Posted 11 years ago #

    Uncomment (that is, remove the // before) query_posts:

    <?php query_posts('category_name=filmtip&showposts=6'); ?>

  3. suedkind
    Posted 11 years ago #

    well this would result in displaying only posts of this category

  4. Michael Bishop

    Posted 11 years ago #

    don't you need <?php the_content(); ?>
    inside the loop?

  5. suedkind
    Posted 11 years ago #

    not in this case, the loop should only display the titles of the posts

  6. moshu
    Posted 11 years ago #

    Am I right thinking you'd like to have a kind of "archived" list of the posts? If so, take a look at Clean Archives, it does exactly that.

  7. Kafkaesqui

    Posted 11 years ago #

    Or remove the 'category_name' portion of your query_posts:

    <?php query_posts('showposts=6'); ?>

    Change the showposts # for lessening/increasing the number of posts displayed.

  8. suedkind
    Posted 11 years ago #

    no, i would like to display the most current posts

    that's it, thank you very much

  9. duckster
    Posted 9 years ago #

    Oooo. Oooo. I think this may actually be what I'm trying to do... I'm using a theme (modified K2) which creates cool tabs across top of the home page, with the name of each Page I've created using Create Page.

    When you click on the tab, it goes to the page with the static content of that page. Obviously. However, I want some of these Pages to have posts that correspond to the posts in a Category of the same name as the post.

    (Clicking on the "News" tab - Page - would show some static content AND underneath the static content show the posts in the "News" Category.)

    Any help would sure be appreciated!

    I need it to work this way because of the theme and some of the other plug-ins I'm using, such as Sidebar Modules.)

  10. duckster: Make a new page template (using a copy of your existing one as a base to work from) and then do pretty much just what he did above. Put a loop in the page template. Then make a page using that template.

  11. duckster
    Posted 9 years ago #

    OK... that's easier said than done for me, I think. My theme has a loop.php, and in the index.template, it says,
    <?php get_header(); ?>

    <div class="content">

    <div id="primary">

    <?php include (TEMPLATEPATH . '/theloop.php'); ?>


    <?php get_sidebar(); ?>


    <?php get_footer(); ?>

    What am I supposed to do here?

Topic Closed

This topic has been closed to new replies.

About this Topic