Enables custom post type archives that will support both paging and feeds. All fully customizable.
Since version 3.1 WordPress has it’s own implementation of custom post type archives so you can create them without this plugin – visit this page for more info -> https://codex.wordpress.org/Post_Types. Nevertheless I do believe that this plugin is more flexible and you can still use it and it will still work as expected.
This plugin will enable custom post type archives (also yearly, monthly and daily) together with feeds, customizable titles and paging.
These archives will work the same way as the category or tag archives work when you go to, for example, http://example.com/category/example.
WordPress 3.0 new custom post type feature is awesome. The only problem is – it lacks archive functionality for these post types so you can’t easely assign one URL to just list your ‘photo’ post type posts. You also won’t be able to get feeds just from this post type. This plugin adds this functionality to WordPress so that you can fully enjoy custom post types. It will also let you to create seperate templates for your post type archives which wasn’t possible before. You will be able to use the same things you are familiar with if you are a theme developer as well as you will be able to enjoy this feature if you are not a developer but just want to enable this feature for your blog.
With this plugin you will be able to specify:
Note that if you update URL base field, disable/enable post type rewrite tag usage or enable/disable some post type archives, then you will have to visit ‘Permalinks’ section under ‘Settings’ to flush old permalinks and enable the changes.
Also a good thing for theme developers – you have four new functions to use:
If you have any issues at all, please try these steps that hopefully will help you:
I will try to help you as good as I can.
Plugin installation is simple and fast.
Note: if you left all the other options blank then post type archives will be accessible from URL ‘http://example.com/{POST_TYPE}’, where {POST_TYPE} is your post type slug (post type name thats safe for URL). Plugin will try to use {POST_TYPE}.php (from your theme root) to render the post type archive and if it won’t exist, then index.php (from your theme root) will be used.
You should go to ‘Permalinks’ submenu under ‘Settings’ menu in WordPress admin backend after you update ‘URL base’ or ‘Enabled Custom Post Type Archives’ options. This will force WordPress to flush the old rewrite rules and re-generate the new ones that will have the stuff plugin needs in them.
The prefix for URLs that will lead to your post type archives. If you want to access your post types from URL ‘http://example.com/{POST_TYPE}’ then leave this option blank. If you want to have an URL ‘http://example.com/post-type/{POST_TYPE}’ then you would put ‘post-type’ as this options value. And if you want ‘http://example.com/some/long/link/to/post/type/{POST_TYPE}’ then you would put ‘some/long/link/to/post/type’ as options value.
This might be a bit hard to understand. If you don’t know what it is, then leaving it enabled, probably, is the best option. By default the rewrite slug will be the same as post type name, but you can change it if you like. Please look at these examples:
register_post_type('photo', array( /* other options */ )); // will have a rewrite slug 'photo' register_post_type('photo', array( /* other options */ 'rewrite' => array('slug' => 'awesome-photo') )); // will have a rewrite slug 'awesome-photo'
If you never specify a custom rewrite slug, then I would suggest disabling this option because it will work just fine, because the post type name will be the same as the rewrite slug. Although, if you specify custom rewrite slugs, then enabling this option is what you want, otherwise the URLs will have the post type name in them not post type rewrite slug. I made this choise, because I think (note the ‘I think’ – I havent tested it…yet), that disabling this option will make the code a bit faster.
You put the title you want to appear in post type archive in here. You can use several variables in this option:
I have so many space variables because WordPress trims variables before saving. Anyway – if you have a post type with name ‘Photo’, a seperator ‘»’ and ‘Title’ options value ‘{POST_TYPE_NAME} {SEP}’, then title on ‘Photo’ post type archive would be ‘Photos »’.
If you leave this option blank, then title won’t be changed (it will probably be blank).
It’s also worth noting that the same variables will be available for the custom – per custom post type – ‘Title’ options as well. If they are left blank then it will fall back to global ‘Title’ option.
The template name that will be used to render post type archives. You can use a {POST_TYPE} variable in this name and that will be replaced with current post type. So if this option has a value ‘post-type-{POST_TYPE}.php’ and you are in ‘photo’ post type archive, then ‘post-type-post.php’ template will be used. Templates should live in the root of your theme directory. If you leave this field blank then it will default to ‘{POST_TYPE}.php’.
Name of the template that will be used if the template that’s stored in ‘Template Pattern’ option won’t exist. So if you have ‘Template Pattern’ option value of ‘{POST_TYPE}.php’, ‘Fallback Template’ option value of ‘fallback.php’ and you are in a post type archive for post type ‘photo’, but ‘photo.php’ doesn’t exist then ‘fallback.php’ will be used. Template should live in the root of your theme directory. If you leave this field blank, then it defaults to ‘index.php’.
That’s because the ‘automatic-feed-links’ support is enabled for your theme. Don’t worry – the feed links will be included automatically!
You can only see this option if ‘Use Rewrite Slug’ option is enabled.
Sadly you can’t do it from backend. But! You can do it using the ‘pta_add_feed_link’ filter! Just return false in it and thats it! Here’s an example (put this in themes functions.php file):
function disable_pta_feed_links($add_feed_links) { return false; } add_filter('pta_add_feed_link', 'disable_pta_feed_links');
Just put ‘/feed/’ at the end of your post type archive URL. That’s how WordPress will know that you want an RSS feed of that. (it will also support all the other feed types as well, like atom and rdf)
get_the_post_type_permalink function will return the permalink where the_post_type_permalink will echo the link.
You can pass an optional argument for these functions:
If at the end functions can’t get the post type slug then will return/echo an empty string.
The functon takes two arguments:
Function will do the same thing as the wp_get_archives function (it even uses the same function to get the data). I had to create a wrapper for that function because WordPress lacked hooks to let me fix the URLs that came out. Basically it it the same function with additional ‘post_type’ argument so please read the wp_get_archives documentation.
P.S. It might not work properly with ‘weekly’ archives.