Changeset 557029
- Timestamp:
- 06/13/2012 01:42:23 AM (14 years ago)
- Location:
- category-sticky-posts/trunk
- Files:
-
- 2 edited
-
bz_category_sticky.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
category-sticky-posts/trunk/bz_category_sticky.php
r553671 r557029 5 5 Description: Set sticky posts for individual category archives 6 6 Author: Brian Zeligson 7 Version: 0.1 27 Version: 0.13 8 8 Author URI: http://www.workinginboxershorts.com 9 9 … … 56 56 add_action( 'admin_init', array($this, 'bz_category_sticky_add_custom_box'), 1 ); 57 57 add_action( 'save_post', array($this, 'bz_category_sticky_save_postdata') ); 58 add_filter('post_class', array($this, 'bz_category_sticky_add_sticky_class')); 58 59 add_filter( 'the_posts', array($this, 'bz_category_sticky_filter_output'), 1); 59 60 } … … 140 141 } 141 142 143 function bz_category_sticky_add_sticky_class($classes) 144 { 145 global $post; 146 if (property_exists($post, 'sticky_in_cat')) $classes[] = 'category_sticky_post'; 147 return $classes; 148 } 149 142 150 public function bz_category_sticky_filter_output($posts) 143 151 { … … 149 157 { 150 158 $sticky_post = get_post($bz_cat_sticky_post); 159 $sticky_post->sticky_in_cat = true; 151 160 if ($sticky_post->post_status === 'publish') $newposts[] = $sticky_post; 152 161 } -
category-sticky-posts/trunk/readme.txt
r553672 r557029 5 5 Requires at least: 2.9.1 6 6 Tested up to: 3.2.1 7 Stable tag: tags/0.1 27 Stable tag: tags/0.13 8 8 9 9 Allows you to set Sticky posts for individual category archives. … … 12 12 13 13 After installing and activating, there will be a Category Sticky meta box on the Edit Post page. Add categories where you want the post you're editing to be sticky and update the post, and you're done. 14 15 When displayed as sticky posts in a category listing, posts will have a 'category_sticky_post' class added to them for additional styling. 14 16 15 17 Note that this plugin uses the "the_posts" filter. This means you can set a post sticky for a category that it doesn't belong to, and it will show on that category when the archive is viewed.
Note: See TracChangeset
for help on using the changeset viewer.