Add a link to the WordPress method, wordpress links _php Tutorial

Source: Internet
Author: User
Tags sorted by name

WordPress add links to the method, WordPress links


Links for each individual blog can be said to be necessary, there are many people choose to join the link column in the sidebar, but the establishment of a separate link page is also a good choice. With plug-ins can easily do this, but like the original I, can solve their own hands-on, or to solve their own hands. Toss a bit, the method will come out.

Common methods
The steps to establish a link page is also relatively simple, first set up a new page template, UF chain function to adjust the chain, plus CSS landscaping, things are done.

Let's talk about specific steps.

1. Create a new template page
Copy the page.php file in the topic and rename it to links.php.
At the top of the page, add the following code

<?php/*template name:links*/?>

And then put a code similar to the following

<?php the_content ();?>

Replaced by

Copy the Code code as follows:

Random site Ordering

<?php wp_list_bookmarks (' Orderby=rand&show_images=1 ');?>


Replace the links.php in the theme folder root directory, and then create a new page, in the page template to select the newly created "Links", save.
Explain the code above.
My_list_bookmarks is the function of the WordPress UF chain, the order is a friend chain ordering, here I write is Rand, that is, random show_images is to control whether the picture of the friend chain, Boolean variable, 1 represents the display variable, 0 delegates are not displayed, other optional parameters are as follows:
Categorize
Boolean to set whether the connection displays category according to their respective categories
String type, followed by the direct "= Link Category ID Number", then the link under this category is displayed. If not specified, all links are displayed.
Category_name
String type, if "= Name of a link category" Then the name of the category will be displayed before the link is categorized, and if left blank, the category name of all linked categories (that is, the default form) will be displayed.
Category_before
A string of text or code that precedes the link classification.
Category_after
A string of text or code after the link is categorized.
Class
The string type, each link classification will have a "class" attribute (from the above code can be seen), the default is: Linkcat
Category_orderby
The string type, the sort method of the link classification, according to the noun or ID.
' Name ' (default)
' ID '
Category_order
String type, link classification of the ascending order of the way:
ASC (default)
DESC
Title_li
The string type, header text or code for the link title, by default: Bookmarks, and it controls whether the connection is arranged in a list.
Title_before and Title_after
As the name implies, they are the text or code before and after the header header, which by default is the H2 tag
Show_private
Boolean, whether to show private links.
Include
A string type that outputs the blogroll of the specified ID, separated by a half-width "," between each ID. All blogroll categories are displayed by default.
Exclude
A string that excludes the Blogroll category link for the specified ID from the entire list of links, separating each ID with a half-width ",". By default, nothing is ruled out.
By
The string type, the blogroll arrangement (by default, is sorted by name, unless the value is left blank), that is, according to the parameters we have in the WP background link setting interface:
(1) ' ID '
(2) ' URL '
(3) ' name '
(4) ' Target '
(5) ' Description '
(6) ' owner '
(7) ' rating '
(8) ' Updated '
(9) ' rel ' – arranged by a set relationship
(Ten) ' Notes '
(one) ' RSS '
(a) ' length ' – Length setting of the connection name
(+) ' Rand ' – randomly arranged display
Order
String type, setting the arrangement of the ascending order
ASC (default)
DESC
Limit
Integer that sets the maximum number of output link bars. The default value is " -1″, output all."
Between
The string type, the text or code between each connection, picture, and description, is the default "n" line break.
Show_description
Boolean, whether to allow the description of each link to be displayed.
Show_rating
Boolean, whether the level of the link is allowed to be displayed.
show_updated
Boolean, whether to allow the last updated timestamp to be displayed.
Hide_invisible
Boolean, whether to display all links or even links that are not visible by the administrator, are allowed to be displayed by default.

2. Add CSS Landscaping, the following is a personal CSS for everyone to refer to

. lists {padding:5px; margin:25px Auto Auto 0;}. linkcat {font-size:12px; font-weight:bolder; padding:5px; margin-bottom:15px; list-style:none; clear:both}.lists Li H 2 {font-size:14px; margin-bottom:15px; color: #99CC33;}. Listcat ul {margin-left:20px;}. Linkcat ul li {float:left; margin-bottom:20px; margin-left:20px; padding:4px 0 4px 6px; width:150px; border:1px soli D #d9d9d9;}. Linkcat ul li a {color: #a4a4a4; text-decoration:none;}. Linkcat ul li a img {margin-right:3px;}. Linkcat ul li a:visited {color: #a4a4a4;}. Tips {font-size:14px; margin-bottom:18px; margin-left:5px;}

Using jquery
The specific implementation steps are in two steps:
1. Loading the jquery library, you can call the Google jquery library directly

Copy the Code code as follows:

2. Load the jquery function code and note the jquery closure
$ (". Linkpage a"). each (function (e) {$ (this). Prepend ("");});
This jquery means traversing all the a tags of class linkpage, and then adding an IMG to the a tag, where ". Linkpage" needs to be changed according to your own template.

http://www.bkjia.com/PHPjc/1133116.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133116.html techarticle detailed WordPress Add links to the method, WordPress friendship link links for each individual blog can be said to be necessary, there are many people choose to join the side bar Friendship ...

  • 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.