WordPress style css php modify instance Arrangement

Source: Internet
Author: User

1. Use category as the navigation bar

<? PHP wp_list_categories ('depth = 2 & title_li = 0 & orderby = Name & show_count = 0');?>

Add this sentence to the nav in header. php. My page is as follows:

<Nav> <Div id = "navdiv"> <ul id = "nav"> <LI <? PHP if (is_home () echo 'class = "current_page_item" '?> <A href = "<? PHP bloginfo ('url');?> /"> Homepage </a> </LI> <? PHP // wp_list_pages ('title _ li = & depth = 1 & include = ');?> <? PHP wp_list_categories ('depth = 2 & title_li = 0 & orderby = Name & show_count = 0');?> </Ul> </div> </nav>

It was originally used as the page navigation, but now it is replaced by category for navigation.

2. The following describes the usage of wp_list_categories.

Wp_list_categories is used to display the link list of all categories. Two representation methods are available: list_cats () (Deprecated) and wp_list_cats () (Deprecated ).

<? PHP wp_list_categories ('parameter');?> The default parameters are as follows:

<? PHP $ ARGs = array ('show _ option_all '=> '', // do not list the category link 'orderby' => 'name ', // sort 'order' => 'asc 'by category name, // sort 'style' => 'LIST' in ascending order ', // The list shows the category 'show _ count' => 0, // The number of category logs is not displayed. 'hide _ empty' => 1, // do not display the category 'use _ desc_for_title '=> 1, // display the category description 'child _ of' => 0, // The subcategory 'feed' => ''is not restricted. // The feed 'feed _ type' =>'' is not displayed '', // do not display the feed category 'feed _ image' => '', // do not display the feed image 'exclude' => '', // The category 'exclude _ tree' => ''is not displayed, // The category tree 'include '=>'' is not displayed, and the category tree 'hie is not displayed. Rarchical '=> 1, // displays the parent/sub-category 'title _ Lil' => _ ('category '), // use "categories" as the title 'show _ option_none '=> _ ('no categories'), 'number' => null, 'echo '=> 1, // display (echos) category 'depth' => 0, // unlimited list depth 'current _ category '=> 0, 'pad _ counts' => 0, 'taxonomy' => 'category ', 'walker' => null);?>

Look at http://codex.wordpress.org/Template_Tags/wp_list_categories

3. log on to and log out of Registration

If (is_user_logged_in () is used to determine whether to log on

Wp_login_url () function --------- logon hyperlink

Wp_logout_url () function -------- logout hyperlink

<A href = "<? PHP echo wp_logout_url () ;?> "> Logout </a>

<A href = "<? PHP echo wp_login_url () ;?> "> Login </a>

If you only log on and log out a simple word, write it directly <? PHP wp_loginout ();?> You can.

  

<? PHP wp_register ($ before, $ after);?> Register a function

Where$ Before(String) (optional)RegisterLink orWebsite ManagementText displayed before the link. Default Value: '<li>'

$ After(String) (optional)RegisterLink orWebsite ManagementText displayed after the link. Default Value: '</LI>'

No text to be displayed in the before and after parameters <? PHP wp_register ('','');?>

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.