• Hey,

    I’d like to display a list of posts, pretty much like the one on the homepage, in the upper part of every post-page. So I copied the loop from the homepage into the single.php file. Sadly that didn’t work as I expected. Instead of displaying all the posts, it shows only the one on which’s page I’m currently on.

    I tried some things out, that I found here https://codex.www.ads-software.com/The_Loop and in the forums, but the thing is, I’m not much of a coder and I don’t really know what I’m doing. So a little help or a push in the right direction would be really appreciated. ??

    This is the loop I have on the single.php:

    <?php rewind_posts(); ?>
                    <?php $content_query = new WP_Query( array(	'category_name' => 'projekte','posts_per_page' => 2 ) ); ?>
                    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                        <li class="projektTeaser">
                            <?php if ( has_post_thumbnail() ) : ?>
                                <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" class="button" >
                                    <?php the_post_thumbnail(); ?>
                                    <?php the_title(); ?>
                                </a>
                            <?php endif; ?>
                        </li>
                    <?php endwhile; endif; ?>
                    <?php wp_reset_query(); ?>

    Cheers,
    Coerv

  • The topic ‘List of post within the post page’ is closed to new replies.