Getting multiple posts to fall under the correct heading
-
I’m not sure if this is the correct place, but I’ve created a plugin that is kind of working. All the posts that have a specific category must be displayed and go according to their year that they were published.
The problem I’m having is that if 2 or more posts was published in the same year then the title (which is the year) repeats itself instead of the posts just falling under the year.
This is how it looks right now:
2015
test2015
test 22014
test 32013
test 4but the way I want it is
2015
test
test 22014
test 32013
test 4Here is the code I’m using
function test(){ query_posts('category_name=Previous Events&showposts=5'); // echo the_date('Y'); while (have_posts()) : the_post(); ?> <div id="ss-links" class="ss-links"> <a href="#<?php the_time('Y'); ?>"><?php the_time('Y'); ?></a> </div> <?php endwhile; while (have_posts()) : the_post(); ?> <ul class="timeline"> <li> <div id="<?php the_time('Y'); ?>" class="tldate"> <?php the_time('Y'); ?> </div> </li> <li> <div class="tl-circ"></div> <div class="timeline-panel"> <div class="tl-heading"> <h4><?php the_title(); ?></h4> </div> <div class="tl-body"> <p><?php the_excerpt(); ?></p> </div> </div> </li> </ul> <?php endwhile; ?> <?php } add_shortcode('test', 'test');
I hope I’ve explained everything clearly.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Getting multiple posts to fall under the correct heading’ is closed to new replies.