• i can’t figure this out, but it should be easy? i think in MT this was called a “date header”

    i am not using a date archive, i just want a category template to list all posts for that category, and create date headings…

    september 05
    – entry title
    – entry title etc etc

    october 05
    – entry title
    – entry title etc etc

    again, this is not a ‘date archive’

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try this ?
    <?php

    /*
    Plugin Name: SPS-Archives 1.0 PR
    Plugin URI: https://stevepsharpe.co.uk/2005/05/02/sps-archives-v10-pr/
    Description: The plug-in will show your archives by month/year by default and has the facility to be switched to category view.
    Version: 1.0 PR
    Author: Steve P. Sharpe
    Author URI: https://stevepsharpe.co.uk
    Call funtion on page by using the following code <?php get_sps_archives(); ?>

    */

    Thread Starter nearlythere

    (@nearlythere)

    found the plugin here:
    found here: https://stevepsharpe.co.uk/sps_archives_v1PR.zip
    looks like that developer is using other software. “Powered by EE 1.3” and he’s not officially hosting the plugin anymore. but i’ll give it a try right now.

    just in case anyone is wondering, yes, i did try the single_month_title(); which would work for anyone who was using date archive pages.

    it looks like all date tags only work on date archives? not on category template, etc.
    https://codex.www.ads-software.com/Template:Tag_Date_Tags

    is that a bug or a feature?

    Thread Starter nearlythere

    (@nearlythere)

    that plugin only works for date archives.

    anyway, this seems crazy that you can’t use the date header on non-date archive pages and within the loop to group elements by day, month, etc.. i guess i’m used to the way MT (movable type) use a date header.

    here’s how to group by day:
    https://codex.www.ads-software.com/User:MCincubus/group_by_day

    i modified this to group by month. i’m using mine on a custom category template that is displaying festivals for an entire year. with month sub-headings. so i’ll include the entire loop from the top with the query_posts function, in case it can be of use to anyone.

    <?php
    $current_year = date('Y');
    ?>

    <h2 class="pagetitle">Festivals and start dates - <?php echo ($current_year); ?> </h2>

    <?php query_posts("cat=23&year=$current_year&order=ASC"); ?>

    <?php if (have_posts()) :
    $last_month = false;
    while (have_posts()) : the_post();
    if (!$last_month) {
    the_date('F Y', '<h2 class="date"> ','</h2>');
    $last_month = get_the_time('F-Y');
    } elseif ($last_month != get_the_time('F-Y')) {
    the_date('F Y', '<h2 class="date">','</h2>');
    $last_month = get_the_time('F-Y');
    }
    ?>

    <!-- entry stuff here -->
    <h3><?php the_title(); ?> </h3>
    <?php edit_post_link('(edit this) ', '', ''); ?>
    <?php the_content(); ?>

    Start Time: <?php the_time('j F Y, G:i'); ?>
    <?php endwhile; ?>
    <?php else : ?><br />
    <h2><span>Not Found</span></h2><br />
    <?php endif; ?>

    totally loopy, but it works.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘probably easy: date sub-headings?’ is closed to new replies.