예제 #1
0
 /**
  * Admin requests for orderby column
  *
  * @since     1.0
  */
 public function get_stored_columns($type)
 {
     return Codepress_Admin_Columns::get_stored_columns($type);
 }
예제 #2
0
 /**
  * 	Add taxonomy filters to posts
  *
  * 	@since     1.4.2
  */
 function callback_restrict_posts()
 {
     global $post_type_object;
     if (!isset($post_type_object->name)) {
         return false;
     }
     // make a filter foreach taxonomy
     $taxonomies = get_object_taxonomies($post_type_object->name, 'names');
     // get stored columns
     $db_columns = Codepress_Admin_Columns::get_stored_columns($post_type_object->name);
     if ($taxonomies) {
         foreach ($taxonomies as $tax) {
             // ignore core taxonomies
             if (in_array($tax, array('post_tag', 'category', 'post_format'))) {
                 continue;
             }
             // only display taxonomy that is active as a column
             if (isset($db_columns['column-taxonomy-' . $tax]) && $db_columns['column-taxonomy-' . $tax]['state'] == 'on') {
                 $terms = get_terms($tax);
                 $terms = $this->indent($terms, 0, 'parent', 'term_id');
                 $terms = $this->apply_dropdown_markup($terms);
                 $select = "<option value=''>" . __('Show all ', CPAC_TEXTDOMAIN) . "{$tax}</option>";
                 if (!empty($terms)) {
                     foreach ($terms as $term_slug => $term) {
                         $selected = isset($_GET[$tax]) && $term_slug == $_GET[$tax] ? " selected='selected'" : '';
                         $select .= "<option value='{$term_slug}'{$selected}>{$term}</option>";
                     }
                     echo "<select class='postform' name='{$tax}'>{$select}</select>";
                 }
             }
         }
     }
 }