Support » Plugin: Ambrosite Post Formats Widget » [Plugin: Ambrosite Post Formats Widget] active item css selector

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author ambrosite


    It may be possible. I normally update my plugins after a new version of WordPress is released. WP 3.3 is coming out at the end of November; I will see about adding the requested feature at that time.

    Thanks! Looking fwd to it!

    Couldn’t wait… so here’s how I did it:

    For the LIST… replace:

    echo '<li class="post-format-item"><a title="' . str_replace('%format', $string, $tooltip) . '" href="' . get_post_format_link($slug) . '">' . $string . '</a>' . $count . $format_id . '</li>';


    $class = '';
    if(is_tax('post_format') && get_post_format()==str_replace('post-format-', '', $post_format->slug)){
    	$class = ' current_format_item';
    echo '<li class="post-format-item'.$class.'"><a title="' . str_replace('%format', $string, $tooltip) . '" href="' . get_post_format_link($slug) . '">' . $string . '</a>' . $count . $format_id . '</li>';

    For the DROPDOWN… replace:

    echo '<option class="level-0" value="' . $slug . '">' . $string . $count . $format_id . '</option>';


    $selected = '';
    if(is_tax('post_format') && get_post_format()==str_replace('post-format-', '', $post_format->slug)){
    	$selected = 'selected';
    echo '<option '.$selected.' class="level-0" value="' . $slug . '">' . $string . $count . $format_id . '</option>';

    Also… too bad that for links the DROPDOWN uses – http://name.tld/?post_format=image – and LIST uses – http://name.tld/archives/type/image – (or whatever other permalink customizations is defined). Consistency would be nice too, but didn’t bother fixing.

    Let me know if you can consider implementing and releasing updated version.

    Plugin Author ambrosite



    Thanks for sharing your code. I am patiently awaiting the release of WP 3.3 (which it now appears will be delayed by a few weeks), but as soon as it comes out I will look to incorporating your changes into the plugin.

    Just found there is a much easier and cleaner way to do the post formats listing:

    $args=$args = array(
    	'taxonomy'     => 'post_format',
    	'orderby'      => 'name',
    	'show_count'   => 1,
    	'hierarchical' => 0,
    	'title_li'     => ''
    echo wp_list_categories( $args );

    Also… found a nasty bug with the counting of total posts. Both your code and mine will show incorrect counts, that include draft/pending/trashed posts. Seems to be a know issue with WP:

    Keeping counts hidden for now. Hope a fix comes soon.


    Plugin Author ambrosite


    I just released an updated version of the plugin. I added the code for the active item css/selector more or less as given in this thread (thank you deadelvis). I also fixed the inconsistency in the link formats — both the list and the dropdown now use permalinks instead of query strings, assuming permalinks are enabled.

    As far as the post counts being off: I am pulling that value directly from the “count” column in the wp_term_taxonomy table. Reading through the various Trac tickets that have been created for this problem, it looks like the bug is deep in the WordPress core. I really don’t want to get involved in trying to fix that particular bug, since the core devs don’t seem to be concerned about it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Ambrosite Post Formats Widget] active item css selector’ is closed to new replies.