Archive-Pro-Matic Decade Filters

As of Archive-Pro-Matic version 1.1.10 we have added two filters two filters for the decade archives list:

Filter: apm_decade_archive_list


apm_decade_archive_title is used to display how the decade appears in the archive list. The default list is YYYY’s, for example:
2010’s

2000’s

apply_filters('apm_decade_archive_list', $text, $decade);

This filter can be used to change how the decade list is displayed by adding the following to the function.php file in the child-theme.

add_filter( 'apm_decade_archive_list', 'list_decade_range', 10, 2 );
function list_decade_range($text, $decade){
   $text = $decade.' - '.($decade + 9);
   return $text;
}

Filter: apm_decade_archive_title

apm_decade_archive_title is used to display the title of the decade archive page. The default title is The YYYY’s for example:
The 2000’s

apply_filters('apm_decade_archive_title', $title, $decade);

And would be used by adding the following to the child theme’s function.php file:

add_filter( 'apm_decade_archive_title', 'decade_range_title', 10, 2 );
function decade_range_title($title, $decade){
   $title .= ' ('.$decade.' - '.($decade + 9).')';
   return $title;
}

Here is an example shortcode that will list an archive of posts by decade:

[archives type="decade"/]


Archive-Pro-Matic Birthday and Birthmonth types

This is a test of two new types of Archive-Pro-Matic archive lists:
Birthday: Show all posts published on the same day of the year
Birth Month: Show all post published on the same month, regardless of year

Birth Month

[archives type="birthmonth" order="ASC" /]

Birthday

[archives type="birthday" order="ASC"/]
[archives type="birthday" order="ASC" sub_options="true" sub_order="ASC"/]
[archives type="birthday" order="ASC" sub_options="true" sub_order="ASC" show_empty="true"/]
[archives type="birthday" order="ASC" sub_options="block" sub_order="ASC" show_empty="true" tag="div" sub_ul_class="my_slim_ul" li_class="block_archive_item" empty_class="grey"/]

Collapse-O-Matic Nested Grouping

This is a test of nesting grouping. First, nested highlander grouping:

[expand title="This" rel="main-highlander"]
[expandsub1 title="This One" rel="this-highlander"]One[/expandsub1]
[expandsub1 title="This Two" rel="this-highlander"]Two[/expandsub1]
[expandsub1 title="This Three" rel="this-highlander"]Three[/expandsub1]
[/expand]

[expand title="That" rel="main-highlander"]
[expandsub1 title="That One" rel="that-highlander"]One[/expandsub1]
[expandsub1 title="That Two" rel="that-highlander"]Two[/expandsub1]
[expandsub1 title="that Three" rel="that-highlander"]Three[/expandsub1]
[/expand]
This
This One
One
This Two
Two
This Three
Three
That
That One
One
That Two
Two
that Three
Three

Collapse-O-Matic New Findme Options

This is a test of the new findme options available with collapse-o-matic. In addition to the values of ‘auto’ and a fixed numeric offset, the findme attributes now supports ‘trigger’ and ‘target’.

Target

[expand title="trigger" findme="target"]hidden content[/expand]
trigger
hidden content

For target to make sense, there would need to be content between the trigger and target. We do this using the roll-your-own method:

<div class="collapseomatic find-me" id="my_example" title="trigger text" data-offset="-60" data-findme="target">trigger text</div>

some bulky content. Notice the offset of -60, this is to compensate for the sticky menu element at the top of the page.

<div id="target-my_example" class="collapseomatic_content ">Target Content</div>
trigger text

This is some bulky content… how about a picture of a donkey.

I am a donkey in a manhole.
Target Content

Archive-Pro-Matic Advanced Category Archives

Building on the new block-style archive described in the last post, we now try with categories:

All Categories:

[archives type="monthly" taxonomy="category" sub_options="block" tag="div" sub_ul_class="my_slim_ul" li_class="block_archive_item" limit="10"/]

Single Category

[archives type="monthly" taxonomy="category" term="archive-pro-matic" sub_options="block" tag="div" sub_ul_class="my_slim_ul" li_class="block_archive_item" limit="10"/]

or use the cat attribute:

[archives type="monthly" cat="special1-posts" sub_options="block" tag="div" sub_ul_class="my_slim_ul" li_class="block_archive_item" limit="10"/]

or use the category attribute (alias for cat):

[archives type="monthly" category="special1-posts" sub_options="block" tag="div" sub_ul_class="my_slim_ul" li_class="block_archive_item" limit="10"/]

Multiple Categories

For an archive of multiple categories, the cat_id attribute must be used:

[archives type="monthly" cat_id="55,43" sub_options="block" tag="div" sub_ul_class="my_slim_ul" li_class="block_archive_item" limit="10"/]

Archive-Pro-Matic – Advanced Monthly Sub Archives

This is a test to create a category archive in the following format:

  • 2020
  • January
  • February
  • Mar
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
  • 2018
  • Jan
  • February
  • March
  • April
  • May
  • June
  • Jul
  • Aug
  • September
  • October
  • November
  • December
  • 2013
  • Jan
  • February
  • March
  • Apr
  • May
  • June
  • July
  • August
  • September
  • October
  • Nov
  • December
  • 2012
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • Sep
  • October
  • November
  • Dec


Step one: allow the sub_options attribute to work with standard monthly archives.

[archives type="monthly" sub_options="true" limit="10" /]

Step two: add new feature to allow sub_options to be sorted ASC (1 – 12) or DESC (default: 12 – 1). New attribute: sub_order

[archives type="monthly" sub_options="true" sub_order="ASC" limit="10" /]


Step three: add the ability show empty months as placeholders. New attribute: show_empty

[archives type="monthly" sub_options="true" show_empty="true" limit="10" /]

Step four: allow month date to be formatted: January becomes Jan. New attribute: month_format just use the date_format attribute

[archives type="monthly" sub_options="true" date_format="M" sub_order="ASC" show_empty="true" limit="10" /]

Step five: test that this works with category filters. Here we use cat_id to only show archives for category id 55:

[archives type="monthly" cat_id="55" sub_options="true" sub_order="ASC" show_empty="true" limit="10" date_format="M"/]
  • 2020
    • January
    • February
    • March
    • Apr
    • May
    • June
    • Jul
    • August
    • September
    • October
    • Nov
    • December
  • 2019
    • January
    • February
    • March
    • April
    • May
    • June
    • July
    • Aug
    • September
    • October
    • November
    • Dec
  • 2018
    • January
    • Feb
    • March
    • April
    • May
    • June
    • July
    • August
    • September
    • October
    • November
    • December
  • 2017
    • Jan
    • Feb
    • March
    • April
    • May
    • June
    • July
    • August
    • September
    • October
    • November
    • December
  • 2014
    • January
    • February
    • March
    • April
    • May
    • Jun
    • July
    • August
    • September
    • October
    • November
    • December

A single category archive can be shown using the category slug with the cat attribute:

[archives type="monthly" cat="collapse-pro-matic" sub_options="true" sub_order="ASC" show_empty="true" date_format="m" limit="10" /]
  • 2020
    • January
    • February
    • 03
    • April
    • 05
    • June
    • July
    • August
    • September
    • October
    • November
    • December
  • 2018
    • 01
    • February
    • March
    • April
    • May
    • June
    • 07
    • 08
    • September
    • October
    • November
    • December
  • 2017
    • January
    • February
    • March
    • April
    • May
    • 06
    • July
    • August
    • 09
    • 10
    • November
    • 12
  • 2016
    • 01
    • February
    • March
    • April
    • May
    • June
    • July
    • August
    • September
    • October
    • November
    • December

Step six: adjust format so year and months are displayed in a single line. The following attributes have been added to add classnames to the archive elements for styling:

  • class – classname for the archive element
  • li_class – classname for a LI element
  • sub_ul_class – classname for a sub ul element
  • sub_li_class – classname for a sub LI element
  • empty_class – classname for an empty LI element

To test this we first need to define some simple classes:

.my_clean_achive {
   border: 1px dotted black;
}
.my_sub_achive {
   border: 1px dotted red;
}
.red a {
   color: red;
   font-weight: bold;
}
.green a {
   color: green;
}
.grey {
   color: #999999;
}

Now we just need to assign the classes to the archive elements:

[archives type="monthly" cat="collapse-pro-matic" sub_options="true" sub_order="ASC" show_empty="true" date_format="M" limit="10" class="my_clean_achive" sub_ul_class="my_sub_achive" li_class="red" sub_li_class="green" empty_class="grey"/]
  • 2020
    • January
    • February
    • Mar
    • April
    • May
    • June
    • July
    • August
    • September
    • October
    • November
    • December
  • 2018
    • Jan
    • February
    • March
    • April
    • May
    • June
    • Jul
    • Aug
    • September
    • October
    • November
    • December
  • 2017
  • 2016
    • Jan
    • February
    • March
    • April
    • May
    • June
    • July
    • August
    • September
    • October
    • November
    • December

Now that we can control the CSS of every element we can finally create a block style archive using the following css:

.block_archive_item {
    display:inline;
    margin-left: 5px;
    white-space: nowrap;
}
.block_archive_item a {
   color: red;
}

[archives type="monthly" cat="collapse-pro-matic" sub_options="true" sub_order="ASC" show_empty="true" month_format="M" limit="10" li_class="block_archive_item" empty_class="grey"/]

Nearly there:

  • 2020
    • Jan
    • Feb
    • Mar
    • Apr
    • May
    • Jun
    • Jul
    • Aug
    • Sep
    • Oct
    • Nov
    • Dec
  • 2018
  • 2017
  • 2016
    • Jan
    • Feb
    • Mar
    • Apr
    • May
    • Jun
    • Jul
    • Aug
    • Sep
    • Oct
    • Nov
    • Dec
  • Now if we do not want the sub_options (months in this case) to be in a separate element (ul) we need a way let the system know: new accepted value ‘block’ for the sub_options attribute: sub_options=”block”.

    [archives type="monthly" sub_options="block" limit="10" /]

    We also no longer need to wrap the entire archive in a UL element, so we use tag=”div”. Finally we need to assign a sub_ul_class to slim down the sub_ul elements:

    .my_slim_ul {
       margin: 0;
    }
    
    [archives type="monthly" cat="collapse-pro-matic" sub_options="block" sub_order="ASC" show_empty="true" date_format="M" limit="10" 
    tag="div" sub_ul_class="my_slim_ul" li_class="block_archive_item" empty_class="grey"/]

    The final result:

    • 2020
    • January
    • February
    • Mar
    • April
    • May
    • June
    • July
    • August
    • September
    • October
    • November
    • December
    • 2018
    • Jan
    • February
    • March
    • April
    • May
    • June
    • Jul
    • Aug
    • September
    • October
    • November
    • December
    • 2013
    • Jan
    • February
    • March
    • Apr
    • May
    • June
    • July
    • August
    • September
    • October
    • Nov
    • December
    • 2012
    • January
    • February
    • March
    • April
    • May
    • June
    • July
    • August
    • Sep
    • October
    • November
    • Dec

    Done!

    Grouping with Rel vs Togglegroup Attbitues

    Rel Attribute

    Here is an example of using the rel attribute. Notice how selecting a member of one group will auto-collapse members of all other groups.

    [expand title="Star Wars" rel="fiction" swaptitle="Not Star Trek"]Target Content[/expand]
    [expand title="Star Trek" rel="fiction"]Target Content[/expand]
    [expand title="Battlestar Galactica" rel="fiction"]Target Content[/expand]
    [expand title="Space Race" rel="history"]Target Content[/expand]
    [expand title="Ansari X Prize" rel="history"]Target Content[/expand]
    Star Wars
    Target Content
    Star Trek
    Target Content
    Battlestar Galactica
    Target Content
    Space Race
    Target Content
    Ansari X Prize
    Target Content

    Togglegroup Attribute

    Here is an example using the togglegroup attribute. Members of multiple togglegroups may be open at the same time.

    [expand title="Star Wars" togglegroup="togfiction"]Target Content[/expand]
    [expand title="Star Trek" togglegroup="togfiction"]Target Content[/expand]
    [expand title="Battlestar Galactica" togglegroup="togfiction"]Target Content[/expand]
    [expand title="Space Race" togglegroup="toghistory"]Target Content[/expand]
    [expand title="Ansari X Prize" togglegroup="toghistory"]Target Content[/expand]
    Star Wars
    Target Content
    Star Trek
    Target Content
    Battlestar Galactica
    Target Content
    Space Race
    Target Content
    Ansari X Prize
    Target Content

    Rel Highlander Grouping

    Here is an example using the rel attribute with highlander grouping:

    [expand title="Star Wars" rel="fiction-highlander" swaptitle="Not Star Trek"]Target Content[/expand]
    [expand title="Star Trek" rel="fiction-highlander"]Target Content[/expand]
    [expand title="Battlestar Galactica" rel="fiction-highlander"]Target Content[/expand]
    [expand title="Space Race" rel="history-highlander"]Target Content[/expand]
    [expand title="Ansari X Prize" rel="history-highlander"]Target Content[/expand]
    Star Wars
    Target Content
    Star Trek
    Target Content
    Battlestar Galactica
    Target Content
    Space Race
    Target Content
    Ansari X Prize
    Target Content

    Highlander Grouping using Togglegroup Attribute

    [expand title="Monkeys" togglegroup="animal-highlander"]Target Content[/expand]
    [expand title="Donkeys" togglegroup="animal-highlander"]Target Content[/expand]
    [expand title="Tigers" togglegroup="animal-highlander"]Target Content[/expand]
    [expand title="Bears" togglegroup="animal-highlander"]Target Content[/expand]
    [expand title="Porsche" togglegroup="car-highlander"]Target Content[/expand]
    [expand title="Volvo" togglegroup="car-highlander"]Target Content[/expand]
    [expand title="Mercedes" togglegroup="car-highlander"]Target Content[/expand]
    Monkeys
    Target Content
    Donkeys
    Target Content
    Tigers
    Target Content
    Bears
    Target Content
    Porsche
    Target Content
    Volvo
    Target Content
    Mercedes
    Target Content

    Group Attribute

    This is a test of the group attribute which is being considered to replace rel, will be used as an alias for now:

    [expand title="Star Wars" group="gfic" swaptitle="Not Star Trek"]Target Content[/expand]
    [expand title="Star Trek" group="gfic"]Target Content[/expand]
    [expand title="Battlestar Galactica" group="gfic"]Target Content[/expand]
    [expand title="Space Race" group="ghis"]Target Content[/expand]
    [expand title="Ansari X Prize" group="ghis"]Target Content[/expand]
    Star Wars
    Target Content
    Star Trek
    Target Content
    Battlestar Galactica
    Target Content
    Space Race
    Target Content
    Ansari X Prize
    Target Content

    Quick test to make to see if our ‘number’ issue has been fixed:

    [expand title="123" rel="123"]this is a number group[/expand]
    [expand title="456" rel="456"]this is also a number group[/expand]
    123
    this is a number group
    456
    this is also a number group