Plugin Directory

Changeset 557029


Ignore:
Timestamp:
06/13/2012 01:42:23 AM (14 years ago)
Author:
beezeee
Message:

add class to sticky posts for styling

Location:
category-sticky-posts/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • category-sticky-posts/trunk/bz_category_sticky.php

    r553671 r557029  
    55 Description: Set sticky posts for individual category archives
    66 Author: Brian Zeligson
    7  Version: 0.12
     7 Version: 0.13
    88 Author URI: http://www.workinginboxershorts.com
    99
     
    5656        add_action( 'admin_init', array($this, 'bz_category_sticky_add_custom_box'), 1 );
    5757        add_action( 'save_post', array($this, 'bz_category_sticky_save_postdata') );
     58    add_filter('post_class', array($this, 'bz_category_sticky_add_sticky_class'));
    5859    add_filter( 'the_posts', array($this, 'bz_category_sticky_filter_output'), 1);
    5960    }
     
    140141    }
    141142   
     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   
    142150    public function bz_category_sticky_filter_output($posts)
    143151    {
     
    149157    {
    150158        $sticky_post = get_post($bz_cat_sticky_post);
     159        $sticky_post->sticky_in_cat = true;
    151160        if ($sticky_post->post_status === 'publish') $newposts[] = $sticky_post;
    152161    }
  • category-sticky-posts/trunk/readme.txt

    r553672 r557029  
    55Requires at least: 2.9.1
    66Tested up to: 3.2.1
    7 Stable tag: tags/0.12
     7Stable tag: tags/0.13
    88
    99Allows you to set Sticky posts for individual category archives.
     
    1212
    1313After 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
     15When displayed as sticky posts in a category listing, posts will have a 'category_sticky_post' class added to them for additional styling.
    1416
    1517Note 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.