Plugin Directory

Changeset 415686


Ignore:
Timestamp:
07/27/2011 12:33:29 AM (15 years ago)
Author:
mfields
Message:

Version 0.6.1

Location:
taxonomy-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • taxonomy-widget/trunk/readme.txt

    r415011 r415686  
    5454==Changelog==
    5555
     56= 0.6.1 =
     57* Set value of the "taxonomies" property a bit later in the action sequence.
     58
    5659= 0.6 =
    5760* Cleanup.
  • taxonomy-widget/trunk/taxonomy-widget.php

    r415011 r415686  
    44Plugin URI:     http://wordpress.org/extend/plugins/taxonomy-widget/
    55Description:    Display taxonomy terms in your sidebar.
    6 Version:        0.6
     6Version:        0.6.1
    77Author:         Michael Fields
    88Author URI:     http://wordpress.mfields.org/
     
    6464        );
    6565
    66         /* Get all public taxonomies. */
    67         $this->taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
    68         if ( empty( $this->taxonomies ) ) {
    69             return;
    70         }
    71 
    72         $taxonomies = array_keys( $this->taxonomies );
    73         if ( ! in_array( 'category', $taxonomies ) ) {
    74             $this->default_args['taxonomy'] = $taxonomies[0];
    75         }
    76 
    7766        /* Custom CSS is for logged-in users only. */
    7867        if ( current_user_can( 'edit_theme_options' ) ) {
     
    8271        }
    8372
    84         /* Javascript listeners for dropdowns. */
     73        add_action( 'wp_loaded', array( &$this, 'set_taxonomies' ) );
    8574        add_action( 'wp_footer', array( &$this, 'listeners_print' ) );
     75    }
     76
     77    /**
     78     * Set the "taxonomies" property.
     79     *
     80     * Value should contain all public taxonomies registered with WordPress.
     81     * This function should fire sometime after the 'init' hook.
     82     *
     83     * @since      0.6.1
     84     */
     85    public function set_taxonomies() {
     86        $this->taxonomies = get_taxonomies( array( 'public' => 1 ), 'objects' );
     87
     88        $names = array_keys( $this->taxonomies );
     89        if ( ! in_array( 'category', $names ) ) {
     90            $this->default_args['taxonomy'] = $names[0];
     91        }
    8692    }
    8793
Note: See TracChangeset for help on using the changeset viewer.