Changeset 350101
- Timestamp:
- 02/23/2011 10:56:17 PM (15 years ago)
- Location:
- custom-post-type-archives/trunk
- Files:
-
- 2 edited
-
post-type-archives.php (modified) (9 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-post-type-archives/trunk/post-type-archives.php
r307139 r350101 5 5 Description: Enables archives (with feeds and paging) for custom post types 6 6 Author: Rolands Atvars 7 Version: 1. 47 Version: 1.5 8 8 Author URI: http://ratvars.com 9 9 */ … … 199 199 return $wp_rewrite; 200 200 } 201 add_filter('generate_rewrite_rules', 'pta_register_post_type_rewrite_rules' );201 add_filter('generate_rewrite_rules', 'pta_register_post_type_rewrite_rules', 100); 202 202 203 203 /** … … 213 213 */ 214 214 function pta_register_post_type_redirects($template, $force_post_type = false) { 215 if(! is_post_type_archive() and $force_post_type === false) return $template;215 if(!pta_is_post_type_archive() and $force_post_type === false) return $template; 216 216 217 217 if(is_404()) // we are in a custom post type archive but there were no posts found for current request … … 240 240 */ 241 241 function pta_fix_post_type_context() { 242 if( is_post_type_archive()) {242 if(pta_is_post_type_archive()) { 243 243 global $wp_query; 244 244 … … 263 263 */ 264 264 function pta_fix_wp_title($wp_title, $sep, $seplocation) { 265 if( is_post_type_archive() and !is_404()) { // do stuff if we are in post type archive that has posts (is not 404)265 if(pta_is_post_type_archive() and !is_404()) { // do stuff if we are in post type archive that has posts (is not 404) 266 266 $query_post_type = get_query_var('post_type'); 267 267 $title = pta_get_settings('title'); // let's get the title now … … 308 308 */ 309 309 function pta_fix_body_class($classes) { 310 if(! is_post_type_archive()) return $classes;310 if(!pta_is_post_type_archive()) return $classes; 311 311 312 312 $archive_classes = array( … … 327 327 */ 328 328 function pta_add_feed_link() { 329 if(! is_post_type_archive()) return; // if we are not in post type archive - quit!329 if(!pta_is_post_type_archive()) return; // if we are not in post type archive - quit! 330 330 331 331 // only add the feed link if theme supports auto feed links or user enabled it … … 359 359 * @return bool 360 360 */ 361 function is_post_type_archive($specific_post_type = false) {361 function pta_is_post_type_archive($specific_post_type = false) { 362 362 static $is_post_type_index; 363 363 … … 382 382 383 383 return $is_post_type_index; 384 } 385 386 /** 387 * Since WP v3.1 WordPress implements it's own is_post_type_archive function so I had to rename it to 388 * pta_is_post_type_archive. 389 * To make things backwards compatible (with pre-3.1 releases) we just implement is_post_type_archive function 390 * and forward it to pta_ist_post_type_archive. 391 */ 392 if(!function_exists('is_post_type_archive')) { 393 function is_post_type_archive($specific_post_type = false) { 394 return pta_is_post_type_archive($specific_post_type); 395 } 384 396 } 385 397 -
custom-post-type-archives/trunk/readme.txt
r307139 r350101 4 4 Tags: custom post types, custom post type, post types, post type, archive, archives, rewrite, feeds, paging, post type url, custom post type url, custom post type archive url, post type archive url, custom post type index, post type index 5 5 Requires at least: 3.0 6 Tested up to: 3. 0.17 Stable tag: 1. 46 Tested up to: 3.1 7 Stable tag: 1.5 8 8 9 9 Enables custom post type archives that will support both paging and feeds. All fully customizable. 10 10 11 11 == Description == 12 13 **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 -> http://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.** 12 14 13 15 This plugin will enable custom post type archives (also yearly, monthly and daily) together with feeds, customizable titles and paging. … … 31 33 Also a good thing for theme developers - you have four new functions to use: 32 34 33 * is_post_type_archive - this function will work similary as is_category or is_single and so on. It will return true if this page is a custom post type archive or false if it isn't. You can also specify an optional argument with post type name and then function will return boolean to say whether you're in post type archive for that post type or not. Simple and useful!35 * pta_is_post_type_archive - this function will work similary as is_category or is_single and so on. It will return true if this page is a custom post type archive or false if it isn't. You can also specify an optional argument with post type name and then function will return boolean to say whether you're in post type archive for that post type or not. Simple and useful! 34 36 * get_the_post_type_permalink - this function will return a link to custom post type archive for current post in the WordPress loop. Or you can specify a post type slug or post ID or post object as an argument if you are not in a loop. In this way you can always link to custom post type archives wherever you are. 35 37 * the_post_type_permalink - uses get_the_post_type_permalink to echo the link rather than return it. … … 163 165 == Changelog == 164 166 167 = 1.5 = 168 * This version should now support WordPress 3.1. 169 * Function 'is_post_type_archive' is renamed to 'pta_is_post_type_archive', because since v3.1 WordPress implements it's own 'is_post_type_archive' function and WordPress's function won't work correctly with this plugin so you should use 'pta_is_post_type_archive' if you use this plugin. 'is_post_type_archive' function implemented by this plugin will still be available if you have a WordPress install older than v3.1. 170 165 171 = 1.4 = 166 172 * Added support for yearly, monthly and daily archives. Now you can just put year and month and day at the end of the custom post type archive URLs to show only posts from those dates. It works the same way as in other places. … … 201 207 == Upgrade Notice == 202 208 209 = 1.5 = 210 Added support for WordPress 3.1. Renamed function 'is_post_type_archive' to 'pta_is_post_type_archive'. Use this function if you use WP 3.1 or newer. 211 203 212 = 1.4 = 204 213 Added support for daily, monthly and yearly archives and added a function like 'wp_get_archives' only for custom post types. Also added body classes.
Note: See TracChangeset
for help on using the changeset viewer.