WordPress Friendship link function: Wp_list_bookmarks ()

Source: Internet
Author: User

The code is as follows:

The code is as follows Copy Code

Add_filter (' pre_option_link_manager_enabled ', ' __return_true ');

If you want to be in the foreground of the page to show you in WordPress backstage add links, we also want to add links in the foreground page file link call function Wp_list_bookmarks (). Here's a look at this wp_list_bookmarks () the use of the link function.

If you use this function directly, without any parameters, you will be able to invoke all the links you have added, and in the order shown by the links category. If you don't want to show all the links, we'll add the relevant parameters in the Wp_list_bookmarks () function. The Wp_list_bookmarks () parameter is as follows:

The code is as follows Copy Code

Categorize (Boolean) whether all links should be displayed in the appropriate category directory. Default is 1

Category (string) The ID of the linked category directory to be displayed, separated by commas. If you do not specify a category, all link categories that contain links are displayed.

Exclude_category (string) The ID of the linked category directory to be excluded, separated by commas.

Category_name (String) The name of the category to which the link will be displayed. If you do not specify a category, all link categories that contain links are displayed.

Category_before (String) The text that is placed before each linked category directory. The default value is ' <li id= ' [Category ID] ' class= ' linkcat ' > '.

Category_after (String) The text that is placed after the link category. The default value is ' < '/li> '.

Class (String) links the category list. The default value is ' Linkcat '.

The order in which the Category_order (strings) are arranged, and the Category_orderby parameter values are sorted in ascending or descending sequence. ASC, DESC,

Title_li (String) The title of the list of links. If the Title_li is set to empty (0), the list title is not displayed and the list of links is not <ul> </ul> labels Surround (make sure the categorize option is set to 0 for Title_li to take effect).

Title_before (String) ' categorize ' value of 1 (true) displays text before each link category, or text defined in ' Title_li ' when ' categorize ' value is 0 (false). The default value is '

Title_after ' Categorize ' value is 1 (true) when the text that appears after each link category, or when the ' categorize ' value is 0 (false), is defined in ' Title_li '. The default value is '

Whether the Show_private (Boolean) should display a link category (even if the category is considered private).

Include (string) a list of numeric link IDs that are included in the result, separated by commas.

Exclude (string) The ID of the link that will be excluded, separated by commas.

Order by (string) is sorted by link.

The order (string) is sorted by category (ascending or descending) according to the setting in the ' order by ' argument.

Limit (integer) The maximum number of links that can be displayed. The default value is-1 (all links).

Before (string) the text that is placed before the link. The default value is ' <li> '.

After (the string) is placed in the linked text. The default value is ' </li> '.

The following 2 examples are listed below:

Randomly display 10 Links:

The code is as follows Copy Code

<?php wp_list_bookmarks (' orderby=rand&limit=10 ');?>

Displays all links under a category, displays all links under the link category with ID 2, uses linked pictures, does not display link descriptions, and arranges links by URL.

The code is as follows Copy Code

<?php Wp_list_bookmarks (' categorize=0&category=2&before=

<span>&after=</span>&show_images=1&show_description=0&orderby=url ');?>

Through the Wp_list_bookmarks () function, we can freely achieve a variety of links style, Web site navigation site, you can use this wp_list_bookmarks () function to achieve, Just use a little CSS style to decorate it.

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.