本文整理汇总了PHP中get_categories函数的典型用法代码示例。如果您正苦于以下问题:PHP get_categories函数的具体用法?PHP get_categories怎么用?PHP get_categories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_categories函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPicklistOptions
/**
*
* @return array;
*/
public function getPicklistOptions()
{
$tax_args = array('public' => true, '_builtin' => false);
$taxonomies = get_taxonomies($tax_args);
$taxonomies[] = 'category';
$args = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => $taxonomies, 'pad_counts' => true);
$categories = get_categories($args);
$children = array();
if ($categories) {
foreach ($categories as $v) {
$v->title = $v->cat_name;
$v->parent_id = $v->category_parent;
$v->id = $v->cat_ID;
$pt = $v->category_parent;
$list = @$children[$pt] ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
}
//treecurse function from functions.php
$list = treerecurse($children);
$mitems = array();
foreach ($list as $item) {
$mitems[$item->id] = $item->treename;
}
return $mitems;
}
示例2: widget
function widget($args, $instance)
{
extract($args);
$warrior_category_list_title = apply_filters('widget_title', empty($instance['warrior_category_list_title']) ? esc_html__('Categories', 'newmagz') : $instance['warrior_category_list_title'], $instance, $this->id_base);
echo $before_widget;
echo '<div class="category-widget">';
echo $before_title . esc_attr($warrior_category_list_title) . $after_title;
echo '<div class="categories">';
echo '<ul>';
$taxonomy = 'category';
$a = 1;
$tax_terms = get_categories();
foreach ($tax_terms as $tax_term) {
echo '<li>';
echo '<div class="number">' . $a++ . '</div>';
echo '<div class="summary">';
echo '<a href="' . esc_url(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf(esc_html__("View all posts in %s", "newmagz"), $tax_term->name) . '" ' . '>' . $tax_term->name . '<small>' . $tax_term->category_count . esc_html__(' Articles', 'newmagz') . '</small></a>';
echo '</div>';
echo '</li>';
}
echo '</ul>';
echo '</div>';
echo '</div>';
echo $after_widget;
}
示例3: form
function form($instance)
{
$defaults = array('pppage' => '10', 'filter' => 'all');
$instance = wp_parse_args($instance, $defaults);
extract($instance);
$args = array('orderby' => 'name', 'hide_empty' => 0, 'hierarchical' => 1, 'taxonomy' => 'client-category');
$filter_options = get_categories($args);
?>
<p class="description">
<label for="<?php
echo $this->get_field_id('pppage');
?>
">
Posts Per Page
<?php
echo aq_field_input('pppage', $block_id, $pppage, $size = 'full', $type = 'number');
?>
</label>
</p>
<p class="description">
<label for="<?php
echo $this->get_field_id('filter');
?>
">
Show Clients from a specific category?<br />
<?php
echo ebor_portfolio_field_select('filter', $block_id, $filter_options, $filter);
?>
</label>
</p>
<?php
}
示例4: noelie_product_categories
function noelie_product_categories()
{
if (is_woocommerce_activated()) {
global $woocommerce_loop;
$woosave_loop = $woocommerce_loop;
$woocommerce_loop['columns'] = 3;
ob_start();
$args = array('taxonomy' => 'product_cat', 'orderby' => 'name', 'show_count' => 0, 'pad_counts' => 0, 'hierarchical' => 1, 'title_li' => '', 'hide_empty' => 0);
$all_categories = get_categories($args);
$nbrr = count($all_categories);
echo '<section class="storefront-product-section storefront-product-categories">';
echo '<h2 class="section-title">' . __('Product Categories', 'storefront') . '</h2>';
?>
<div class="woocommerce columns-<?php
echo $woocommerce_loop['columns'];
?>
">
<ul class="products">
<?php
$nbr = 1;
foreach ($all_categories as $cat) {
if ($cat->category_parent == 0 && $nb < $woocommerce_loop['columns']) {
$category_id = $cat->term_id;
wc_get_template('content-product_cat.php', array('category' => $cat));
++$nb;
/*get_term_link($cat->slug, 'product_cat')*/
}
}
ob_get_contents();
$woocommerce_loop = $woosave_loop;
}
}
示例5: render
function render($atts, $content = null)
{
parent::render($atts);
$buffy = '';
extract(shortcode_atts(array('limit' => '6', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'header_color' => ''), $atts));
$cat_args = array('show_count' => true, 'orderby' => 'count', 'hide_empty' => false, 'order' => 'DESC', 'number' => $limit + 1, 'exclude' => get_cat_ID(TD_FEATURED_CAT));
// exclude categories from the demo
if (TD_DEPLOY_MODE == 'demo' or TD_DEPLOY_MODE == 'dev') {
$cat_args['exclude'] = '44,45,46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 110, ' . get_cat_ID(TD_FEATURED_CAT);
}
$categories = get_categories($cat_args);
$buffy .= '<div class="td_block_wrap td_popular_categories widget widget_categories">';
$buffy .= $this->get_block_title();
if (!empty($categories)) {
$buffy .= '<ul class="td-pb-padding-side">';
foreach ($categories as $category) {
if (strtolower($category->cat_name) != 'uncategorized') {
$buffy .= '<li><a href="' . get_category_link($category->cat_ID) . '">' . $category->name . '<span class="td-cat-no">' . $category->count . '</span></a></li>';
}
}
$buffy .= '</ul>';
}
$buffy .= '</div> <!-- ./block -->';
return $buffy;
}
示例6: optionsframework_options
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the "id" fields, make sure to use all lowercase and no spaces.
*
*/
function optionsframework_options()
{
$themename = 'wp_get_theme' ? wp_get_theme() : wp_get_theme();
$themename = $themename['Name'];
$shortname = "of";
//Stylesheet Reader
$alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow");
// Test data
$test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
// Multicheck Array
$multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
// Multicheck Defaults
$multicheck_defaults = array("one" => "1", "five" => "1");
// Background Defaults
$background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
// Pull all the categories into an array
$options_categories = array();
$options_categories_obj = get_categories();
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
// Pull all the pages into an array
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
$options_pages[''] = 'Select a page:';
foreach ($options_pages_obj as $page) {
$options_pages[$page->ID] = $page->post_title;
}
// If using image radio buttons, define a directory path
$imagepath = get_stylesheet_directory_uri() . '/images/';
$options = array(array("name" => __("General Settings", "wrockmetro"), "type" => "heading"), array("name" => __("Custom Favicon URL", "wrockmetro"), "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "wrockmetro_favicon", "type" => "upload"), array("name" => __("Latest Posts", "wrockmetro"), "desc" => "Show 5 Latest Posts with Thumbnail in Sidebar.", "id" => "wrockmetro_activate_ltposts", "std" => "1", "type" => "checkbox"), array("name" => __("Show Author Profile", "wrockmetro"), "desc" => "Check the box to show Author Profile Below the Post.", "id" => "wrockmetro_author", "std" => "", "type" => "checkbox"), array("name" => __("Ads Management", "wrockmetro"), "type" => "heading"), array("name" => "Activate Ads Space Below Navigation", "desc" => "Activate Ads Space Below Navigation and put code in below test field.", "id" => "wrockmetro_banner", "std" => "", "type" => "checkbox"), array("name" => __("Ads code Below Main Navigation.", "wrockmetro"), "desc" => "Enter your ads code here, preferably a 728*15 link list unit, or a 728*90 lead-board ad.", "id" => "wrockmetro_banner_top", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Single Post", "wrockmetro"), "desc" => "Path of the image to be displayed in sidebar section.", "id" => "wrockmetro_ad2", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Footer", "wrockmetro"), "desc" => "Paste Ad Code for Footer Area below navigation.", "id" => "wrockmetro_ad1", "std" => "", "type" => "textarea"), $options[] = array("name" => __("Custom CSS", "wrockmetro"), "type" => "heading"), array("name" => __("Custom CSS", "wrockmetro"), "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "wrockmetro_customcss", "std" => "", "type" => "textarea"), array("name" => __("Social Media", "wrockmetro"), "type" => "heading"), array("name" => __("Show Social Follow ICONs", "wrockmetro"), "desc" => "Check the box to show social sites Follows buttons in Sidebar.", "id" => "wrockmetro_sharebut", "std" => "", "type" => "checkbox"), array("name" => __("Facebook URL", "wrockmetro"), "desc" => "Enter your Facebook URL if you have one", "id" => "wrockmetro_fb", "std" => "", "type" => "text"), array("name" => __("Twitter URL", "wrockmetro"), "desc" => "Enter your Twitter URL if you have one", "id" => "wrockmetro_tw", "std" => "", "type" => "text"), array("name" => __("RSS Feed URL", "wrockmetro"), "desc" => "Enter your RSS Feed URL if you have one", "id" => "wrockmetro_rss", "std" => "", "type" => "text"), array("name" => __("Google+ URL", "wrockmetro"), "desc" => "Enter your Google+ Link if you have one", "id" => "wrockmetro_gp", "std" => "", "type" => "text"), array("name" => __("Linked In URL", "wrockmetro"), "desc" => "Enter your Linkedin URL if you have one", "id" => "wrockmetro_in", "std" => "", "type" => "text"), array("name" => __("YouTube In URL", "wrockmetro"), "desc" => "Enter your YouTube URL if you have one", "id" => "wrockmetro_youtube", "std" => "", "type" => "text"), array("name" => __("Pinterest In URL", "wrockmetro"), "desc" => "Enter your Pinterest URL if you have one", "id" => "wrockmetro_pinterest", "std" => "", "type" => "text"), array("name" => __("Stumbleupon In URL", "wrockmetro"), "desc" => "Enter your Stumbleupon URL if you have one", "id" => "wrockmetro_stumbleupon", "std" => "", "type" => "text"), array("name" => __("Instagram In URL", "wrockmetro"), "desc" => "Enter your Instagram URL if you have one", "id" => "wrockmetro_instagram", "std" => "", "type" => "text"), array("name" => __("email In URL", "wrockmetro"), "desc" => "Enter your email URL if you have one", "id" => "wrockmetro_email", "std" => "", "type" => "text"));
update_option('of_themename', $themename);
return $options;
}
示例7: smittenkitchen_filter_category_rewrite_rules
/**
* Remove the 'category' base from category URIs.
*/
function smittenkitchen_filter_category_rewrite_rules($rules)
{
$categories = get_categories(array('hide_empty' => false));
if (is_array($categories) && !empty($categories)) {
$slugs = array();
foreach ($categories as $category) {
if (is_object($category) && !is_wp_error($category)) {
if (0 == $category->category_parent) {
$slugs[] = $category->slug;
} else {
$slugs[] = trim(get_category_parents($category->term_id, false, '/', true), '/');
}
}
}
if (!empty($slugs)) {
$rules = array();
foreach ($slugs as $slug) {
$rules['(' . $slug . ')/feed/(feed|rdf|rss|rss2|atom)?/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
$rules['(' . $slug . ')/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
$rules['(' . $slug . ')(/page/(\\d+))?/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[3]';
}
}
}
return $rules;
}
示例8: tst_get_user_skills
function tst_get_user_skills($member_id)
{
global $ITV_USER_SKILLS_EXCLUDE_CATEGORIES;
$user_skills = get_user_meta($member_id, 'user_skills', true);
if (!is_array($user_skills)) {
$user_skills = $user_skills ? array($user_skills) : array();
}
$categories = get_categories(array('taxonomy' => 'category', 'hide_empty' => 0));
$categories_filtered = array();
$parent_categories = array();
foreach ($categories as $category) {
if (array_search($category->slug, $ITV_USER_SKILLS_EXCLUDE_CATEGORIES) === false) {
$category_hash = (array) $category;
$category_hash['checked'] = array_search($category->term_id, $user_skills) === false ? false : true;
if ($category->parent) {
$parent_categories[$category->parent] = 1;
}
$categories_filtered[] = $category_hash;
}
}
$categories = array();
foreach ($categories_filtered as $category) {
if (!isset($parent_categories[$category['term_id']])) {
$categories[] = $category;
}
}
usort($categories, function ($a, $b) {
return $a['parent'] > $b['parent'] ? -1 : 1;
});
return $categories;
}
示例9: getTags
/**
* get all tags
*
* @return array
*/
public static function getTags()
{
$taxonomy = 'post_tag';
$args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 0, 'taxonomy' => $taxonomy);
$tags = get_categories($args);
return $tags;
}
示例10: venedor_page_get_postdata
function venedor_page_get_postdata()
{
global $page_meta_boxes, $wp_registered_sidebars;
// Page Meta Options
$theme_layouts = venedor_ct_layouts();
$theme_layouts = array_merge(array("widewidth" => "Wide Width"), $theme_layouts);
$sidebar_options = venedor_ct_sidebars();
$banner_type = venedor_ct_banner_type();
$banner_width = venedor_ct_banner_width();
$layer_sliders = venedor_ct_layer_sliders();
$rev_sliders = venedor_ct_rev_sliders();
$portfolio_columns = array("2" => "2 Columns", "3" => "3 Columns", "4" => "4 Columns");
$portfolio_cats = array();
$portfolio_cats[0] = 'All Categories';
$pcats = get_categories(array('taxonomy' => 'portfolio_cat'));
foreach ($pcats as $pcat) {
$portfolio_cats[$pcat->term_id] = $pcat->name;
}
$faq_cats = array();
$faq_cats[0] = 'All Categories';
$fcats = get_categories(array('taxonomy' => 'faq_cat'));
foreach ($fcats as $fcat) {
$faq_cats[$fcat->term_id] = $fcat->name;
}
// Page Meta Boxes
$page_meta_boxes = array("breadcrumbs" => venedor_labels_meta("breadcrumbs", "Breadcrumbs", "Disable breadcrumbs", "checkbox"), "title" => venedor_labels_meta("title", "Page Title", "Hide page title", "checkbox"), "layout" => venedor_labels_meta("layout", "Layout", "Select the layout.", "radio", "fullwidth", "radio", $theme_layouts), "sidebar" => venedor_labels_meta("sidebar", "Sidebar", "Select the sidebar you would like to display. <strong>Note</strong>: You must first create the sidebar under <strong>Appearance > Sidebars</strong>.", "customselect", "blog-sidebar", "", $sidebar_options), "header_on_banner" => venedor_labels_meta("header_on_banner", "Header on Banner", "Show header on banner. When select <strong>\"Banner Type\"</strong> to <strong>\"Layerslider\"</strong>, <strong>\"Revolution Slider\"</strong> or <strong>\"Banner\"</strong>, this option will be work.", "checkbox"), "bg_rev_slider" => venedor_labels_meta("bg_rev_slider", "Background Slider", "Select the Background Revolution Slider. If you should select <strong>\"Banner Type\"</strong> to <strong>\"Revolution Slider\"</strong>, this will be <strong>synchronize</strong> with <strong>banner revolution slider</strong>.", "customselect", "", "", $rev_sliders), "banner_type" => venedor_labels_meta("banner_type", "Banner Type", "Select the banner type which display above the page content.", "customselect", "", "", $banner_type), "banner_width" => venedor_labels_meta("banner_width", "Banner Width", "Select the banner width", "radio", "wide", "radio", $banner_width), "layer_slider" => venedor_labels_meta("layer_slider", "LayerSlider", "Select the LayerSlider.", "customselect", "", "", $layer_sliders), "rev_slider" => venedor_labels_meta("rev_slider", "Revolution Slider", "Select the Revolution Slider.", "customselect", "", "", $rev_sliders), "banner" => venedor_labels_meta("banner", "Banner", "", "textarea"), "product_slider" => venedor_labels_meta("product_slider", "Product Slider", "Comma separated list of product id.", "text"), "infinite_scroll" => venedor_labels_meta("infinite_scroll", "Infinite Scroll", "Enable infinite scroll. Use in <strong>Portfolio</strong> templates.", "checkbox"), "portfolio_columns" => venedor_labels_meta("portfolio_columns", "Portfolio Columns", "The number of the columns in the portfolio page. Use in <strong>Portfolio</strong> template.", "radio", "4", "radio", $portfolio_columns), "portfolio_cat" => venedor_labels_meta("portfolio_cat", "Portfolio Category", "Select the portfolio categories. Use in <strong>Portfolio</strong> template.", "multi_checkbox", "", "", $portfolio_cats), "portfolio_filters" => venedor_labels_meta("portfolio_filters", "Portfolio Filters", "Show the portfolio filters. Use in <strong>Portfolio</strong> template.", "checkbox"), "faq_cat" => venedor_labels_meta("faq_cat", "FAQ Category", "Select the faq categories. Use in <strong>FAQs</strong> template.", "multi_checkbox", "", "", $faq_cats), "faq_filters" => venedor_labels_meta("faq_filters", "FAQ Filters", "Show the faq filters. Use in <strong>FAQs</strong> template.", "checkbox"), "content_top" => venedor_labels_meta("content_top", "Content Top", "Input the content top block.", "text"), "content_bottom" => venedor_labels_meta("content_bottom", "Content Bottom", "Input the content bottom block.", "text"));
}
示例11: get_filterby_terms
function get_filterby_terms()
{
$filtertype = $_POST['filtertype'];
$terms = array();
switch ($filtertype) {
case 'category':
$cats = get_categories();
foreach ($cats as $cat) {
$terms[$cat->term_id] = $cat->name;
}
break;
case 'tag':
$tags = get_tags();
foreach ($tags as $tag) {
$terms[$tag->slug] = $tag->name;
}
break;
case 'post_type':
$terms = $this->project_organizer->available_post_types();
break;
}
$terms = apply_filters('anth_get_posts_by', $terms, $filtertype);
print json_encode($terms);
die;
}
示例12: zfwca_list_categories
/**
* Display a list categories
* @param array $args
* @return bool
*/
function zfwca_list_categories($args = array())
{
$defaults = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'exclude' => '', 'include' => '', 'exclude_tree' => '', 'current_category' => 0, 'taxonomy' => 'category');
$r = wp_parse_args($args, $defaults);
$r['walker'] = new ZFWCA_Post_Category_Walker();
if (!isset($r['class'])) {
$r['class'] = 'category' == $r['taxonomy'] ? 'categories' : $r['taxonomy'];
}
extract($r);
if (!taxonomy_exists($taxonomy)) {
return false;
}
$categories = get_categories($r);
$output = '';
if (empty($categories)) {
$output .= 'No categories';
} else {
if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
$current_term_object = get_queried_object();
if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
$r['current_category'] = get_queried_object_id();
}
}
$output .= walk_category_tree($categories, 0, $r);
}
$output = apply_filters('zfwca_wp_list_categories', $output, $args);
return $output;
}
示例13: no_category_base_rewrite_rules
function no_category_base_rewrite_rules($category_rewrite)
{
//var_dump($category_rewrite); // For Debugging
$category_rewrite = array();
$categories = get_categories(array('hide_empty' => false));
foreach ($categories as $category) {
$category_nicename = $category->slug;
if ($category->parent == $category->cat_ID) {
// recursive recursion
$category->parent = 0;
} elseif ($category->parent != 0) {
$category_nicename = get_category_parents($category->parent, false, '/', true) . $category_nicename;
}
$category_rewrite['(' . $category_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
$category_rewrite['(' . $category_nicename . ')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
$category_rewrite['(' . $category_nicename . ')/?$'] = 'index.php?category_name=$matches[1]';
}
// Redirect support from Old Category Base
global $wp_rewrite;
$old_category_base = get_option('category_base') ? get_option('category_base') : 'category';
$old_category_base = trim($old_category_base, '/');
$category_rewrite[$old_category_base . '/(.*)$'] = 'index.php?category_redirect=$matches[1]';
//var_dump($category_rewrite); // For Debugging
return $category_rewrite;
}
示例14: optionsframework_options
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the "id" fields, make sure to use all lowercase and no spaces.
*
*/
function optionsframework_options()
{
// Test data
$test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
// Multicheck Array
$multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
// Multicheck Defaults
$multicheck_defaults = array("one" => "1", "five" => "1");
// Background Defaults
$background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
// Pull all the categories into an array
$options_categories = array();
$options_categories_obj = get_categories();
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
// Pull all the pages into an array
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
$options_pages[''] = 'Select a page:';
foreach ($options_pages_obj as $page) {
$options_pages[$page->ID] = $page->post_title;
}
// If using image radio buttons, define a directory path
$imagepath = get_bloginfo('stylesheet_directory') . '/admin/images/';
$options_menu_page = array('name' => 'general', 'pagename' => 'general-options', 'title' => 'General Settings');
$options = array();
$options = array(array("name" => "Basic Settings", "type" => "heading"), array("name" => "Input Text Mini", "desc" => "A mini text input field.", "id" => "example_text_mini", "std" => "Default", "class" => "mini", "type" => "text"), array("name" => "Input Text", "desc" => "A text input field.", "id" => "example_text", "std" => "Default Value", "type" => "text"), array("name" => "Textarea", "desc" => "Textarea description.", "id" => "example_textarea", "std" => "Default Text", "type" => "textarea"), array("name" => "Input Select Small", "desc" => "Small Select Box.", "id" => "example_select", "std" => "three", "type" => "select", "class" => "mini", "options" => $test_array), array("name" => "Input Select Wide", "desc" => "A wider select box.", "id" => "example_select_wide", "std" => "two", "type" => "select", "options" => $test_array), array("name" => "Select a Category", "desc" => "Passed an array of categories with cat_ID and cat_name", "id" => "example_select_categories", "type" => "select", "options" => $options_categories), array("name" => "Select a Page", "desc" => "Passed an pages with ID and post_title", "id" => "example_select_pages", "type" => "select", "options" => $options_pages), array("name" => "Input Radio (one)", "desc" => "Radio select with default options 'one'.", "id" => "example_radio", "std" => "one", "type" => "radio", "options" => $test_array), array("name" => "Example Info", "desc" => "This is just some example information you can put in the panel.", "type" => "info"), array("name" => "Input Checkbox", "desc" => "Example checkbox, defaults to true.", "id" => "example_checkbox", "std" => "1", "type" => "checkbox"), array("name" => "Advanced Settings", "type" => "heading"), array("name" => "Check to Show a Hidden Text Input", "desc" => "Click here and see what happens.", "id" => "example_showhidden", "type" => "checkbox"), array("name" => "Hidden Text Input", "desc" => "This option is hidden unless activated by a checkbox click.", "id" => "example_text_hidden", "std" => "Hello", "class" => "hidden", "type" => "text"), array("name" => "Uploader Test", "desc" => "This creates a full size uploader that previews the image.", "id" => "example_uploader", "type" => "upload"), array("name" => "Example Image Selector", "desc" => "Images for layout.", "id" => "example_images", "std" => "2c-l-fixed", "type" => "images", "options" => array('1col-fixed' => $imagepath . '1col.png', '2c-l-fixed' => $imagepath . '2cl.png', '2c-r-fixed' => $imagepath . '2cr.png')), array("name" => "Example Background", "desc" => "Change the background CSS.", "id" => "example_background", "std" => $background_defaults, "type" => "background"), array("name" => "Multicheck", "desc" => "Multicheck description.", "id" => "example_multicheck", "std" => $multicheck_defaults, "type" => "multicheck", "options" => $multicheck_array), array("name" => "Colorpicker", "desc" => "No color selected by default.", "id" => "example_colorpicker", "std" => "", "type" => "color"), array("name" => "Typography", "desc" => "Example typography.", "id" => "example_typography", "std" => array('size' => '12px', 'face' => 'verdana', 'style' => 'bold italic', 'color' => '#123456'), "type" => "typography"));
return $options;
}
示例15: widget
function widget($args, $instance)
{
?>
<div class="category_widget">
<div class="title">
<h4><?php
_e('Category', 'sunnypoint');
?>
</h4>
</div>
<div class="list">
<?php
$all_cats = get_categories();
foreach ($all_cats as $cat) {
?>
<div class="category">
<div class="number"><span><?php
print $cat->count;
?>
</span></div>
<div class="name"><a href="<?php
print get_category_link($cat->cat_ID);
?>
"><p><?php
print $cat->name;
?>
</p></a></div>
</div>
<?php
}
?>
</div>
</div>
<?php
}