Plugin Directory

Changeset 644407


Ignore:
Timestamp:
12/25/2012 05:42:26 PM (13 years ago)
Author:
iteamweb
Message:

added limit to list the categories

Location:
display-categories-widget/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • display-categories-widget/trunk/display_categories_widget.php

    r587701 r644407  
    2323    $title = $instance['title'];
    2424    $category = $instance['category'];
     25    $dcw_limit = $instance['dcw_limit'];
    2526
    2627       // Get the existing categories and build a simple select dropdown for the user.
     
    3536
    3637?>
    37   <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
     38  <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
    3839  <!--<p><label for="<?php echo $this->get_field_id('cat_id'); ?>">Category id: <input class="widefat" id="<?php echo $this->get_field_id('cat_id'); ?>" name="<?php echo $this->get_field_name('cat_id'); ?>" type="text" value="<?php echo attribute_escape($cat_id); ?>" /></label></p>-->
    3940
     
    4647                </select>
    4748            </p>
    48 
     49<p><label for="<?php echo $this->get_field_id('dcw_limit'); ?>"><?php _e('Limit (optional):'); ?> <input class="widefat" id="<?php echo $this->get_field_id('dcw_limit'); ?>" name="<?php echo $this->get_field_name('dcw_limit'); ?>" type="text" value="<?php echo attribute_escape($dcw_limit); ?>" /></label></p>
    4950  <?php
    5051  }
     
    5556    $instance['title'] = $new_instance['title'];
    5657    $instance['category'] = $new_instance['category'];
     58    $instance['dcw_limit'] = $new_instance['dcw_limit'];
    5759    return $instance;
    5860  }
     
    6567    $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
    6668    $cat_id = $instance['category'];
     69    $dcw_limit = $instance['dcw_limit'];
    6770 
    6871    if (!empty($title))
    6972      echo $before_title . $title . $after_title;;
    7073    echo "<ul>";
    71     wp_list_categories('orderby=name&child_of='.$cat_id.'&hide_empty=0&title_li=');
     74    wp_list_categories('orderby=name&child_of='.$cat_id.'&hide_empty=0&title_li=&number='.$dcw_limit);
    7275    echo "</ul>";
    7376 
  • display-categories-widget/trunk/readme.txt

    r644223 r644407  
    55Requires at least: 3.3
    66Tested up to: 3.5
    7 Stable tag: 4.3
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535
    3636== Changelog ==
     37= 1.0.2 =
     38* Limit the number of categories that is displayed
     39
    3740= 1.0.1 =
    3841* Description Updated
Note: See TracChangeset for help on using the changeset viewer.