Customizable Entries Archive - hiding inactive years ...

Creating and modifying plugins.
Post Reply
Christine
Regular
Posts: 54
Joined: Thu Mar 26, 2009 12:50 am

Customizable Entries Archive - hiding inactive years ...

Post by Christine » Fri Feb 05, 2016 11:02 am

I really like this plugin, and have managed to tweak a couple of things like changing the default sort order and getting rid of the author field.

I'd really like to be able to hide the years there are no blog posts in the year dropdown box... any way to do this?

User avatar
yellowled
Regular
Posts: 7021
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Customizable Entries Archive - hiding inactive years ...

Post by yellowled » Fri Feb 05, 2016 12:29 pm

Christine wrote:I'd really like to be able to hide the years there are no blog posts in the year dropdown box... any way to do this?
I don't use or even know the plugin at all. There might be a config option for this, but you have probably already checked the plugin config?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Christine
Regular
Posts: 54
Joined: Thu Mar 26, 2009 12:50 am

Re: Customizable Entries Archive - hiding inactive years ...

Post by Christine » Fri Feb 05, 2016 12:33 pm

Yeah, I have checked the config options, unfortunately there's nothing like that there - only options are permalink url and 'format as article'.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Customizable Entries Archive - hiding inactive years ...

Post by Timbalu » Fri Feb 05, 2016 2:25 pm

Christine wrote:I'd really like to be able to hide the years there are no blog posts in the year dropdown box... any way to do this?
I would say: No!
And this, since that is build by a simple counter which does not really interfere with entries, accept for the start year.

Code: Select all

            $custom_sortyears = array();
            $custom_sortyears[] = array('value' => 'all', 'desc' => COMMENTS_FILTER_ALL);
            for ($i = $first_year; $i <= date('Y'); $i++) {
                $custom_sortyears[] = array('value' => $i, 'desc' => $i);
            }
So I assume you have the years 2006, 2007, 2008 ....counting up to 2016 and do not want to have 2007, 2009 and 2012, since you were lazy and did not post any entries in these years, right?

You could "hack" this, since this are probably years that do not change any more, replacing the above part by

Code: Select all

            $exclude_years = array('2007','2009','2012');
            $custom_sortyears = array();
            $custom_sortyears[] = array('value' => 'all', 'desc' => COMMENTS_FILTER_ALL);
            for ($i = $first_year; $i <= date('Y'); $i++) {
                if (in_array($i, $exclude_years)) continue;
                $custom_sortyears[] = array('value' => $i, 'desc' => $i);
            }
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Christine
Regular
Posts: 54
Joined: Thu Mar 26, 2009 12:50 am

Re: Customizable Entries Archive - hiding inactive years ...

Post by Christine » Fri Feb 05, 2016 2:51 pm

Brilliant! It worked perfectly. Thank you so very much :) .

Post Reply