{"id":30012,"date":"2014-06-11T10:00:10","date_gmt":"2014-06-11T10:00:10","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/archives-for-custom-post-types\/"},"modified":"2018-05-24T14:02:24","modified_gmt":"2018-05-24T14:02:24","slug":"archives-for-custom-post-types","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/archives-for-custom-post-types\/","author":8170035,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.2","stable_tag":"1.0.2","tested":"4.3.34","requires":"3.1","requires_php":"","requires_plugins":"","header_name":"Archives for Custom Post Types","header_author":"Jack Lenox","header_description":"","assets_banners_color":"","last_updated":"2018-05-24 14:02:24","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/jacklenox\/archives-for-custom-post-types","header_author_uri":"http:\/\/jacklenox.com","rating":5,"author_block_rating":0,"active_installs":300,"downloads":4408,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"7"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1","1.0.2"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[3621,1487],"plugin_category":[],"plugin_contributors":[82928],"plugin_business_model":[],"class_list":["post-30012","plugin","type-plugin","status-closed","hentry","plugin_tags-archives","plugin_tags-custom-post-types","plugin_contributors-jacklenox","plugin_committers-jacklenox"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/archives-for-custom-post-types.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p><strong>DEPRECATION NOTICE:<\/strong> As of WordPress 4.4, you no longer need this plugin as <code>wp_get_archives()<\/code> now accepts custom post types as an argument. See <a href=\"https:\/\/core.trac.wordpress.org\/ticket\/21596\">#34686<\/a>.<\/p>\n\n\n\n<p>This plugin provides proper support for archived pages of custom post types to match the support for normal posts.<\/p>\n\n<p>The problem is that the function, <code>wp_get_archives()<\/code> does not allow you to pass in a post type. It only works for normal posts. There is a filter called <code>getarchives_where()<\/code> but this doesn't handle the archive URLs (e.g. http:\/\/yoursite.com\/2014\/).<\/p>\n\n<p>So while the filter will help you view the correct archives, it won't work properly in conjunction with the <code>wp_get_archives()<\/code> function. For example, a link to \"June 2014\" emitted by wp_get_archives() will only take you to normal posts from June 2014, not custom post types.<\/p>\n\n<p>This plugin provides a new function: <code>wp_get_archives_cpt()<\/code>. This function can take a post_type argument as well as the usual arguments that can be passed to <code>wp_get_archives()<\/code>. The plugin also provides automatic handling for custom post type archive URLs.<\/p>\n\n<p>This plugin has stemmed from a ticket that I have been working on in core: https:\/\/core.trac.wordpress.org\/ticket\/21596<\/p>\n\n<p>Unfortunately a proper patch for this in core will probably have to go quite deep. I have therefore decided to share this plugin as a temporary solution.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>archives-for-custom-post-types.php<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Place <code>&lt;?php wp_get_archives_cpt( 'post_type=custom_post_type' ); ?&gt;<\/code> in your templates<\/li>\n<\/ol>\n\n<!--section=faq-->\n<p>I haven't had any yet...<\/p>\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd><ol>\n<li>Upload <code>archives-for-custom-post-types.php<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Place <code>&lt;?php wp_get_archives_cpt( 'post_type=custom_post_type' ); ?&gt;<\/code> in your templates<\/li>\n<\/ol><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>Fixed pagination links<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Broke then fixed some stupid minor issues. I've updated trunk and 1.0 a few times so probably better to tag this now.<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial commit. All seems to be working correctly to me.<\/li>\n<\/ul>","raw_excerpt":"A plugin that provides native-like support for dated archive pages of custom post types (e.g. http:\/\/yoursite.com\/2014\/{custom-post-type}\/)","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/30012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=30012"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/jacklenox"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=30012"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=30012"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=30012"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=30012"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=30012"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=30012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}