probably easy: date sub-headings? (4 posts)

  1. nearlythere
    Posted 10 years ago #

    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'

  2. Mark (podz)
    Support Maven
    Posted 10 years ago #

    Try this ?

    Plugin Name: SPS-Archives 1.0 PR
    Plugin URI: http://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: http://stevepsharpe.co.uk
    Call funtion on page by using the following code <?php get_sps_archives(); ?>


  3. nearlythere
    Posted 10 years ago #

    found the plugin here:
    found here: http://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.

    is that a bug or a feature?

  4. nearlythere
    Posted 10 years ago #

    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:

    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.

    $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.

Topic Closed

This topic has been closed to new replies.

About this Topic