Edit Loop Into Days & Categories
-
Hello all! If you could help, I’d greatly appreciate it! Currently, I have edited my loop so that it is divided into days and displays headers for each day. For example, the code output is something like:
<h2>Wednesday, July 30, 2014</h2> <POST ONE> <POST TWO> <POST THREE> <h2>Tuesday, July 29, 2014</h2> <POST ONE> <POST TWO>
It’s great that it’s working and the days are divided, but I also need to divide the days into sub-sections using categories. For example, something like this:
<h2>Wednesday, July 30, 2014</h2> <h3>Columns</h3> <POST ONE> <h3>Links</h3> <POST TWO> <POST THREE> <h2>Tuesday, July 29, 2014</h2> <h3>Columns</h3> <POST ONE> <h3>Links</h3> <POST TWO>
Currently, my loop looks like this:
<div class="blog-style"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if( $current_date != get_the_date('l, F j, Y') ){ echo '<h2 class="date-separator">'.get_the_date('l, F j, Y').'</h2>'; $current_date = get_the_date('l, F j, Y'); } ?> <?php get_template_part(THEME_LOOP."post"); ?> <?php $counter++; ?> <?php endwhile; else: ?> <?php get_template_part(THEME_LOOP."no","post"); ?> <?php endif; ?> <?php customized_nav_btns($paged, $wp_query->max_num_pages); ?> </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Edit Loop Into Days & Categories’ is closed to new replies.