A detailed description of the use of classification function wp_list_categories in WordPress, wplistcategories_php tutorial

Source: Internet
Author: User
Tags sorted by name nginx server

A detailed description of the use of classification function wp_list_categories in WordPress, wplistcategories


Wp_list_categories function is used in WordPress to list the classification of the function of the system, the function has a lot of control output parameters, and today suddenly a friend asked, so I probably tidied up a bit.

Because of the built-in gadget feature in WordPress,
So we can show a category list in the sidebar or anywhere else we want without any function,
So the wp_list_categories function is seldom used by anyone,
The function is somewhat similar to Wp_list_bookmarks,

Wp_list_categories description
The Wp_list_categories function is a function used in WordPress to list the classified links in the system.
English is not in the original, interested can go to look at the official documents.

Usage

<?php wp_list_categories ($args);  $args = Array (' show_option_all ' = ' + ',//whether to list the category link ' order ' = ' = ' name ',//by name order ' = ' ASC ',//L, descending ' Style ' = ' list ',//whether to use the list (Ul>li) ' show_count ' = = 0,//whether to show the number of articles ' Hide_empty ' + 1,//show no log category ' Us E_desc_for_title ' + 1,//whether to show the category description ' child_of ' and 0,//whether to restrict sub-classification ' feed ' + ',//whether to show RSS ' Feed_type ' =& Gt ",//rss type ' feed_image ' + '",//whether to show RSS images ' exclude ' + ',//exclude category ID, multiple uses ', (comma) ' delimited ' exclude_tree ' =  ',///Exclude the classification tree, that is, the parent category and its sub-category ' Include ' = ', '//Includes the category ' Hierarchical ' and true,//whether the child, parent classification rating ' Title_li ' + __ ( ' Categories '),//The name of the list title ' Show_option_none ' + __ (' no Categories '),//No category displayed when the title ' Number ' = null,//show the quantity of the classification ' E     Cho ' + 1,//show, show or return string ' depth ' = 0,//level limit ' current_category ' + 0,//add a no category ' Pad_counts ' = 0,//This I do not understand the ' taxonomy ' and ' category ',//Use the taxonomy ' Walker ' and null//to display the class (very complicated concept)? &Gt 

About ' pad_counts ', I don't understand what this parameter is for,
If you are interested, you can study the official documentation for this parameter.
You can also use it against the wp_list_bookmarks.

Pad_counts (Boolean) calculates link or post counts by including items from child categories. If show_counts and hierarchical are true the This is automatically set to true. This parameter added at Version 2.9 Valid values:1 (True) 0 (false) –default

Working with instances
Show category links that include ID 3,5,9,16, sorted by name

 
  
  
    <?php wp_list_categories (' orderby=name&include=3,5,9,16 ');?>

Displays a list of categories with poetry as headings, including ID 5,9,23

 
  
  
    <?php wp_list_categories (' include=5,9,23&title_li=

    ' . __ (' poetry '). '

    ');?>

Of course you can also write parameters such as the following to integrate the parameters into an array.

<?php $taxonomy   = ' genre '; $orderby   = ' name '; $show _count  = 0;   1 for Yes, 0 for no$pad_counts  = 0;   1 for Yes, 0 for no$hierarchical = 1;   1 for Yes, 0 for no$title    = "; $args = Array (' taxonomy ' = = $taxonomy, ' by ' = ') ' and   $orderby, ' Show_ Count '  = ' = $show _count, ' pad_counts ' +  $pad _counts, ' hierarchical ' + $hierarchical, ' Title_li '   = $title);? > 
 
  
  
    <?php wp_list_categories ($args);?>

The taxonomy taxonomy is a concept that is relative to the label (tag).

Articles you may be interested in:

    • Analysis of correlation function used in WordPress development for caption Display
    • Analysis of PHP function usage in debugging thumbnail in WordPress
    • configuration resolves the WordPress path in the Nginx server does not automatically add a slash problem
    • The PHP function used in WordPress to get the search form is parsed
    • Use the Wp_count_posts function in WordPress to count the number of articles
    • PHP functions for invoking comment templates and looping out comments in WordPress
    • WordPress restricts non-admin users to comment only once after the article
    • Detailed PHP functions for creating and adding filters in WordPress
    • A detailed description of the use of Wp_title () functions in WordPress development

http://www.bkjia.com/PHPjc/1088787.html www.bkjia.com true http://www.bkjia.com/PHPjc/1088787.html techarticle The use of classification function wp_list_categories in WordPress, wplistcategories wp_list_categories function is used in WordPress to list the functions of the classification system, the function has a lot of control ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.