/**
  * PHP5 type constructor
  */
 function __construct($name, $defaultValue = '', $label = '', $textBefore = '', $textAfter = '')
 {
     $args = array('orderby' => 'ID', 'order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 1);
     $categories = get_categories($args);
     parent::__construct($name, $defaultValue, $label, $textBefore, $textAfter);
     //populate the list with all available categories
     foreach ($categories as $cat) {
         $this->addChild(new DropDownOption($cat->name, $cat->cat_ID));
     }
 }
Beispiel #2
0
 /**
  * PHP5 type constructor
  */
 function __construct($name, $defaultValue = '', $label = '', $textBefore = '', $textAfter = '')
 {
     global $wpdb;
     /** @todo Move select to get_authors(). */
     $authors = $wpdb->get_results("SELECT ID, user_nicename from {$wpdb->users} ORDER BY display_name");
     parent::__construct($name, $defaultValue, $label, $textBefore, $textAfter);
     //populate the list with all registered authors
     foreach ($authors as $author) {
         $this->addChild(new DropDownOption($author->user_nicename, $author->ID));
     }
 }