{"id":14486,"date":"2011-09-15T08:00:00","date_gmt":"2011-09-15T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/archivist-custom-archive-templates\/"},"modified":"2024-02-23T20:50:00","modified_gmt":"2024-02-23T20:50:00","slug":"archivist-custom-archive-templates","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/archivist-custom-archive-templates\/","title":{"rendered":"Archivist \u2013 Custom Archive Templates"},"content":{"rendered":"<h4>Quick Start<\/h4>\n<p>The plugin assumes your articles are well categorized.<br \/>\nTo display the archive, use the shortcode anywhere in a page or article.<\/p>\n<pre><code>[archivist category=\"kitten\"]\n[archivist tag=\"kitten\"]\n<\/code><\/pre>\n<p>Replace \u201ckitten\u201d with your category\/tag. Watch out, we need the slug here.<br \/>\nThat\u2019s the name without capital letters and spaces.<\/p>\n<h4>Placeholders<\/h4>\n<p>You can specify a custom template to display the archive elements.<br \/>\nGo to <code>Settings > Archivist<\/code> for plugin preferences.<br \/>\nUse HTML and any of the following template placeholders.<\/p>\n<ul>\n<li><code>%TITLE%<\/code> \u2013 The post title.<\/li>\n<li><code>%PERMALINK%<\/code> \u2013 The post permalink.<\/li>\n<li><code>%AUTHOR%<\/code> \u2013 The post author.<\/li>\n<li><code>%CATEGORIES%<\/code> \u2013 The post categories as unordered list.<\/li>\n<li><code>%CATEGORIES|...%<\/code> \u2013 The post categories with a custom separator. Example: <code>%CATEGORIES|, %<\/code><\/li>\n<li><code>%TAGS%<\/code> \u2013 The post tags with default separator.<\/li>\n<li><code>%TAGS|...%<\/code> \u2013 The post tags with a custom separator. Example: <code>%TAGS|, %<\/code><\/li>\n<li><code>%EXCERPT%<\/code> \u2013 The post excerpt.<\/li>\n<li><code>%POST_META|...%<\/code> \u2013 Any post meta. Example: <code>%POST_META|duration%<\/code>.<\/li>\n<li><code>%POST_META|...|...%<\/code> \u2013 Any post meta list, separated by custom HTML. Example: <code>%POST_META|guest|<br \/>%<\/code><\/li>\n<li><code>%DATE%<\/code> \u2013 The post date with default format.<\/li>\n<li><code>%DATE|...%<\/code> \u2013 The post date with custom format. Example: <code>%DATE|Y\/m\/d%<\/code><\/li>\n<li><code>%POST_THUMBNAIL|...x...%<\/code> \u2013 The post thumbnail with certain dimensions. Example: <code>%POST_THUMBNAIL|75x75%<\/code><\/li>\n<li><code>%COMMENTS%<\/code> \u2013 The post comment count.<\/li>\n<li><code>%ACF|field_name%<\/code> \u2013 Display <a href=\"https:\/\/www.advancedcustomfields.com\" rel=\"nofollow ugc\">ACF<\/a> field. Uses the <a href=\"https:\/\/www.advancedcustomfields.com\/resources\/get_field\/\" rel=\"nofollow ugc\"><code>get_field()<\/code><\/a> function.<\/li>\n<\/ul>\n<p>You can add your own placeholders:<\/p>\n<pre><code>add_filter( 'archivist_template_render', function( $template, $post ) {\n    \/\/ modify $template\n    return $template;\n}, 10, 2 );\n<\/code><\/pre>\n<h4>Pagination<\/h4>\n<p>If you have many entries, you may prefer to paginate. The archivist comes with asynchronous pagination built-in. Use the <code>pagination<\/code> parameter in the shortcode to activate it. Its value is the amount of items you want to display per page.<\/p>\n<pre><code>[archivist category=\"kitten\" pagination=\"10\"]\n<\/code><\/pre>\n<p>Pagination controls are displayed both on top and at the bottom of the archive. You can customize this by setting <code>controls<\/code> to <code>top<\/code> or <code>bottom<\/code>.<\/p>\n<pre><code>[archivist category=\"kitten\" pagination=\"10\" controls=\"top\"]\n<\/code><\/pre>\n<h4>Filter by Query<\/h4>\n<p>Are you feeling bold? Is filtering by category or archive not satisfying you? Read on, I\u2019ve got a challenge for you.<br \/>\nWordPress uses a certain query syntax to define the so called loop which is used to display the archive.<br \/>\nYou can find the complete documentation at https:\/\/codex.wordpress.org\/Class_Reference\/WP_Query<br \/>\nand you can take advantage of every single parameter or combination of parameters listed there. Some examples:<\/p>\n<pre><code>[archivist query=\"year=1984&author_name=gorwell\"]\n<\/code><\/pre>\n<p>Lists all entries from the year <code>1984<\/code> by the author with <code>user_nicename<\/code> <code>gorwell<\/code>.<\/p>\n<pre><code>[archivist query=\"tag=straw+mask&post_status=private&orderby=comment_count&order=DESC\"]\n<\/code><\/pre>\n<p>Lists all entries marked with post status <code>private<\/code> which are tagged with both <code>straw<\/code> and <code>mask<\/code>, ordered by the amount of comments in a descending order.<\/p>\n<h4>Using multiple Templates<\/h4>\n<p>When you install the plugin, there is just one templated called \u201cdefault\u201d.<br \/>\nIf you don\u2019t specify a specific template in the shortcode, this one will be used.<br \/>\nTherefore the following two shortcodes yield identical results.<\/p>\n<pre><code>[archivist category=\"kitten\"]\n[archivist category=\"kitten\" template=\"default\"]\n<\/code><\/pre>\n<p>You can add as many templates as you like. Think twice before deleting one. If it\u2019s still in use, the archive can\u2019t be displayed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shortcode Plugin to display an archive by category, tag or custom query. Customizable via HTML templates.<\/p>\n","protected":false},"author":65,"featured_media":14487,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Archivist \u2013 Custom Archive Templates - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Shortcode Plugin to display an archive by category, tag or custom query. Customizable via HTML templates."},"footnotes":""},"categories":[1],"tags":[644,11,198,345,13],"class_list":["post-14486","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-archive","tag-category","tag-loop","tag-shortcode","tag-tag"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/14486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=14486"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/14486\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/14487"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=14486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=14486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=14486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}