当前位置: 首页>>代码示例>>PHP>>正文


PHP get_all_category_ids函数代码示例

本文整理汇总了PHP中get_all_category_ids函数的典型用法代码示例。如果您正苦于以下问题:PHP get_all_category_ids函数的具体用法?PHP get_all_category_ids怎么用?PHP get_all_category_ids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_all_category_ids函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _generate_additional_categories_checkboxes

 /**
  * Create a list of checkboxes that can be used to select additional categories.
  */
 function _generate_additional_categories_checkboxes($override_name = null)
 {
     global $comicpress_manager;
     $additional_categories = array();
     $invalid_ids = array($comicpress_manager->properties['blogcat']);
     foreach ($this->category_tree as $node) {
         $invalid_ids[] = end(explode('/', $node));
     }
     foreach (get_all_category_ids() as $cat_id) {
         if (!in_array($cat_id, $invalid_ids)) {
             $category = get_category($cat_id);
             $additional_categories[strtolower($category->cat_name)] = $category;
         }
     }
     ksort($additional_categories);
     $name = !empty($override_name) ? $override_name : "additional-categories";
     $selected_additional_categories = explode(",", $comicpress_manager->get_cpm_option("cpm-default-additional-categories"));
     $this->category_checkboxes = array();
     if (count($additional_categories) > 0) {
         foreach ($additional_categories as $category) {
             $checked = in_array($category->cat_ID, $selected_additional_categories) ? "checked=\"checked\"" : "";
             $this->category_checkboxes[] = "<label><input id=\"additional-" . $category->cat_ID . "\" type=\"checkbox\" name=\"{$name}[]\" value=\"" . $category->cat_ID . "\" {$checked} /> " . $category->cat_name . "</label><br />";
         }
     }
     return $this->category_checkboxes;
 }
开发者ID:johnbintz,项目名称:comicpress-manager-1.5,代码行数:29,代码来源:ComicPressView.php

示例2: form

 function form($instance)
 {
     $default = array('title' => 'Widget Demo', 'number_post' => '5', 'current_category' => '');
     // Gộp các giá trị của $default vào $instance để nó trở thành giá trị mặc định
     $instance = wp_parse_args((array) $instance, $default);
     // Gán giá trị ($instance['title'] cho $title (khởi tạo biến $title))
     $title = esc_attr($instance['title']);
     $number_post = esc_attr($instance['number_post']);
     // Get title
     echo "<p>Title:</p>";
     echo "<p><input type=\"text\" name=\"" . $this->get_field_name('title') . "\" value=\"" . $title . "\" /></p>";
     // Select category
     $all_categories = get_all_category_ids();
     echo "<p>Category:</p>";
     echo "<p><select id=\"" . $this->get_field_id('current_category') . "\" name=\"" . $this->get_field_name('current_category') . "\" >";
     foreach ($all_categories as $category) {
         if ($category == $instance['current_category']) {
             echo "<option value=\"" . $category . "\" selected=\"selected\">" . get_cat_name($category) . "</option>";
         } else {
             echo "<option value=\"" . $category . "\">" . get_cat_name($category) . "</option>";
         }
     }
     echo "</select></p>";
     // Get count
     echo "<p>Show number posts:</p>";
     echo "<p><input type=\"text\" name=\"" . $this->get_field_name('number_post') . "\" value=\"" . $number_post . "\" /></p>";
 }
开发者ID:thinh9012,项目名称:Wordpress,代码行数:27,代码来源:widgetqthinh.php

示例3: get_all_category_ids

 /**
  * Retrieves a unique array of all Category IDs in the database.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @uses {@link http://codex.wordpress.org/Function_Reference/get_all_category_ids get_all_category_ids()}
  *
  * @return array Unique array of all Category IDs *(as integers)*.
  */
 public static function get_all_category_ids()
 {
     if (is_array($category_ids = get_all_category_ids())) {
         $category_ids = c_ws_plugin__s2member_utils_arrays::force_integers($category_ids);
     }
     return !empty($category_ids) && is_array($category_ids) ? array_unique($category_ids) : array();
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:17,代码来源:utils-gets.inc.php

示例4: example_add_dashboard_widgets

function example_add_dashboard_widgets()
{
    $cat_ids = get_all_category_ids();
    foreach ($cat_ids as $id) {
        $cat = get_category($id);
        wp_add_dashboard_widget($cat->cat_ID, $cat->cat_name, test);
    }
}
开发者ID:Knorcedger,项目名称:main,代码行数:8,代码来源:index.php

示例5: getCatIdsHomepageDefault

function getCatIdsHomepageDefault()
{
    $catids = get_all_category_ids();
    if (count($catids) > 3) {
        return $catids[0] . ',' . $catids[1] . ',' . $catids[2];
    } else {
        return implode(',', $catids);
    }
}
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:9,代码来源:options.php

示例6: get_video_category_link

 public static function get_video_category_link()
 {
     $category_ids = get_all_category_ids();
     foreach ($category_ids as $cat_id) {
         if (!strcmp(get_cat_name($cat_id), "video")) {
             echo get_category_link($cat_id);
         }
     }
 }
开发者ID:natematias,项目名称:UniLives-Videostream-Widget-Plugin,代码行数:9,代码来源:unilives-videostream.php

示例7: ooc_swap_out_checkboxes

function ooc_swap_out_checkboxes($content)
{
    $content = str_replace('type="checkbox" name="post_category', 'type="radio" name="post_category', $content);
    // for "Most Used" tab
    foreach (get_all_category_ids() as $i) {
        $content = str_replace('id="in-popular-category-' . $i . '" type="checkbox"', 'id="in-popular-category-' . $i . '" type="radio"', $content);
    }
    return $content;
}
开发者ID:jasonglisson,项目名称:babylifehacks,代码行数:9,代码来源:main.php

示例8: test_get_all_category_ids

 /**
  * Validate get_all_category_ids
  *
  * @expectedDeprecated get_all_category_ids
  */
 function test_get_all_category_ids()
 {
     // create categories
     self::factory()->category->create_many(2);
     // create new taxonomy to ensure not included
     register_taxonomy('test_tax_cat', 'post');
     wp_insert_term("test1", 'test_tax_cat');
     // Validate length is 1 + created due to uncategorized
     $cat_ids = get_all_category_ids();
     $this->assertEquals(3, count($cat_ids));
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:16,代码来源:category.php

示例9: find_category_by_name

function find_category_by_name($name)
{
    $cat = null;
    $category_ids = get_all_category_ids();
    foreach ($category_ids as $cat_id) {
        if (!strcmp(get_cat_name($cat_id), "Blog")) {
            $cat = $cat_id;
        }
    }
    return $cat;
}
开发者ID:natematias,项目名称:Mistylook-Hackage,代码行数:11,代码来源:functions.php

示例10: catDropDown

function catDropDown($thisCatID)
{
    if ($thisCatID[1] == "0") {
        $thisCatID[1] = 1;
    }
    $category_ids = get_all_category_ids();
    echo '<OPTION  ' . (isset($thisCatID[0]) && is_null($thisCatID[0]) ? 'selected' : '') . '  VALUE=NULL>Not in Use</OPTION>';
    foreach ($category_ids as $cat_id) {
        $cat_name = get_cat_name($cat_id);
        echo '<OPTION  ' . selected(true, in_array($cat_id, $thisCatID), false) . '  VALUE="' . $cat_id . '">' . $cat_name . '</OPTION>';
    }
}
开发者ID:adams0917,项目名称:woocommerce_eht,代码行数:12,代码来源:options.php

示例11: __construct

 final function __construct()
 {
     $this->_aOptions = get_option('_syndication');
     if (!empty($this->_aOptions['except_category'])) {
         $this->_aCategory = array_diff(get_all_category_ids(), explode(',', $this->_aOptions['except_category']));
     } else {
         $this->_aCategory = get_all_category_ids();
     }
     $this->_sCategory = implode(',', $this->_aCategory);
     $this->_baseUrl = get_bloginfo('url');
     $this->init();
 }
开发者ID:sleeping-lion,项目名称:dojisa,代码行数:12,代码来源:badr-syndication-class.php

示例12: GetCategories

 /**
  *	Get the categories from blog
  *	@return array ID and category names
  */
 function GetCategories()
 {
     global $wpdb;
     $categories = get_all_category_ids();
     $separator = '|';
     $output = array();
     if ($categories) {
         foreach ($categories as $category) {
             $temp_catname = get_cat_name($category);
             if ($temp_catname !== "Uncategorized") {
                 $output[$category] = $temp_catname;
             }
         }
     } else {
         $output = 'test';
     }
     return $output;
 }
开发者ID:JerryWang761208,项目名称:blog-manager,代码行数:22,代码来源:blog-manager.php

示例13: get_category_children

function get_category_children($id, $before = '/', $after = '')
{
    if (0 == $id) {
        return '';
    }
    $chain = '';
    $cat_ids = get_all_category_ids();
    foreach ($cat_ids as $cat_id) {
        if ($cat_id == $id) {
            continue;
        }
        $category = get_category($cat_id);
        if ($category->category_parent == $id) {
            $chain .= $before . $category->cat_ID . $after;
            $chain .= get_category_children($category->cat_ID, $before, $after);
        }
    }
    return $chain;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:19,代码来源:category-template.php

示例14: form

 function form($instance)
 {
     $default = array('number_post_1' => '5', 'current_category_1' => '', 'number_post_2' => '5', 'current_category_2' => '');
     // Initilize default values ($instance)
     $instance = wp_parse_args((array) $instance, $default);
     // Create param, method esc_attr($instance['number_post_1']) : get value number_post_1
     $number_post_1 = esc_attr($instance['number_post_1']);
     $number_post_2 = esc_attr($instance['number_post_2']);
     /* Display column 1  */
     // Select category
     $all_categories = get_all_category_ids();
     echo "<p><strong>COLUMN 1:</strong></p>";
     echo "<p>Category:</p>";
     echo "<p><select id=\"" . $this->get_field_id('current_category_1') . "\" name=\"" . $this->get_field_name('current_category_1') . "\" >";
     foreach ($all_categories as $category) {
         if ($category == $instance['current_category_1']) {
             echo "<option value=\"" . $category . "\" selected=\"selected\">" . get_cat_name($category) . "</option>";
         } else {
             echo "<option value=\"" . $category . "\">" . get_cat_name($category) . "</option>";
         }
     }
     echo "</select></p>";
     // Display number post in a category
     echo "<p>Show number posts:</p>";
     echo "<p><input type=\"text\" name=\"" . $this->get_field_name('number_post_1') . "\" value=\"" . $number_post_1 . "\" /></p>";
     /* Display column 2  */
     // Select category
     echo "<p><strong>COLUMN 2:</strong></p>";
     echo "<p>Category:</p>";
     echo "<p><select id=\"" . $this->get_field_id('current_category_2') . "\" name=\"" . $this->get_field_name('current_category_2') . "\" >";
     foreach ($all_categories as $category) {
         if ($category == $instance['current_category_2']) {
             echo "<option value=\"" . $category . "\" selected=\"selected\">" . get_cat_name($category) . "</option>";
         } else {
             echo "<option value=\"" . $category . "\">" . get_cat_name($category) . "</option>";
         }
     }
     echo "</select></p>";
     // Display number post in a category
     echo "<p>Show number posts:</p>";
     echo "<p><input type=\"text\" name=\"" . $this->get_field_name('number_post_2') . "\" value=\"" . $number_post_2 . "\" /></p>";
 }
开发者ID:thinh9012,项目名称:Wordpress,代码行数:42,代码来源:two_column_content.php

示例15: MigrateContentLevelData

 /**
  * Migrate Level Information for all Content to Database
  * @global object $wpdb
  */
 function MigrateContentLevelData()
 {
     ignore_user_abort(true);
     global $wpdb;
     if (get_option($this->PluginOptionName . '_MigrateContentLevelData') == 1) {
         return;
     }
     // migrate category levels
     $content_types = array('MembershipCategories' => '~CATEGORY', 'MembershipPages' => 'page', 'MembershipPosts' => 'post', 'MembershipComments' => '~COMMENT');
     foreach ($content_types as $Option => $content_type) {
         $data = $this->GetOption($Option);
         foreach ($data as $level => $ids) {
             $ids = array_diff(array_unique(explode(',', $ids)), array('0', ''));
             if (count($ids)) {
                 foreach ($ids as $id) {
                     if (is_numeric($id)) {
                         $wpdb->insert($this->Tables->contentlevels, array('content_id' => $id, 'level_id' => $level, 'type' => $content_type), array('%d', '%s', '%s'));
                     }
                 }
             }
         }
     }
     // category protection
     $ids = array_diff(get_all_category_ids(), explode(',', $this->GetOption('CatProtect')));
     if (count($ids)) {
         foreach ($ids as $id) {
             if (is_numeric($id)) {
                 $wpdb->insert($this->Tables->contentlevels, array('content_id' => $id, 'level_id' => 'Protection', 'type' => '~CATEGORY'), array('%d', '%s', '%s'));
             }
         }
     }
     // category protection
     $ids = array_diff(array_unique(explode(',', $this->GetOption('Protect'))), array('0', ''));
     if (count($ids)) {
         foreach ($ids as $id) {
             if (is_numeric($id)) {
                 $wpdb->insert($this->Tables->contentlevels, array('content_id' => $id, 'level_id' => 'Protection', 'type' => 'post'), array('%d', '%s', '%s'));
             }
         }
     }
     update_option($this->PluginOptionName . '_MigrateContentLevelData', 1);
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:46,代码来源:WLMDB.php


注:本文中的get_all_category_ids函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。