Plugin / Archivist – Custom Archive Templates

Eric Teubert

Description

Description

Quick Start

The plugin assumes your articles are well categorized.
To display the archive, use the shortcode anywhere in a page or article.

[archivist category="kitten"]
[archivist tag="kitten"]

Replace “kitten” with your category/tag. Watch out, we need the slug here.
That’s the name without capital letters and spaces.

Placeholders

You can specify a custom template to display the archive elements.
Go to Settings > Archivist for plugin preferences.
Use HTML and any of the following template placeholders.

  • %TITLE% – The post title.
  • %PERMALINK% – The post permalink.
  • %AUTHOR% – The post author.
  • %CATEGORIES% – The post categories as unordered list.
  • %CATEGORIES|...% – The post categories with a custom separator. Example: %CATEGORIES|, %
  • %TAGS% – The post tags with default separator.
  • %TAGS|...% – The post tags with a custom separator. Example: %TAGS|, %
  • %EXCERPT% – The post excerpt.
  • %POST_META|...% – Any post meta. Example: %POST_META|duration%.
  • %POST_META|...|...% – Any post meta list, separated by custom HTML. Example: %POST_META|guest|<br>%
  • %DATE% – The post date with default format.
  • %DATE|...% – The post date with custom format. Example: %DATE|Y/m/d%
  • %POST_THUMBNAIL|...x...% – The post thumbnail with certain dimensions. Example: %POST_THUMBNAIL|75x75%
  • %COMMENTS% – The post comment count.
  • %ACF|field_name% – Display ACF field. Uses the get_field() function.

You can add your own placeholders:

add_filter( 'archivist_template_render', function( $template, $post ) {
    // modify $template
    return $template;
}, 10, 2 );

Pagination

If you have many entries, you may prefer to paginate. The archivist comes with asynchronous pagination built-in. Use the pagination parameter in the shortcode to activate it. Its value is the amount of items you want to display per page.

[archivist category="kitten" pagination="10"]

Pagination controls are displayed both on top and at the bottom of the archive. You can customize this by setting controls to top or bottom.

[archivist category="kitten" pagination="10" controls="top"]

Filter by Query

Are you feeling bold? Is filtering by category or archive not satisfying you? Read on, I’ve got a challenge for you.
WordPress uses a certain query syntax to define the so called loop which is used to display the archive.
You can find the complete documentation at https://codex.wordpress.org/Class_Reference/WP_Query
and you can take advantage of every single parameter or combination of parameters listed there. Some examples:

[archivist query="year=1984&author_name=gorwell"]

Lists all entries from the year 1984 by the author with user_nicename gorwell.

[archivist query="tag=straw+mask&post_status=private&orderby=comment_count&order=DESC"]

Lists all entries marked with post status private which are tagged with both straw and mask, ordered by the amount of comments in a descending order.

Using multiple Templates

When you install the plugin, there is just one templated called “default”.
If you don’t specify a specific template in the shortcode, this one will be used.
Therefore the following two shortcodes yield identical results.

[archivist category="kitten"]
[archivist category="kitten" template="default"]

You can add as many templates as you like. Think twice before deleting one. If it’s still in use, the archive can’t be displayed.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.