Articles under wordpress call categories

Source: Internet
Author: User
Tags php foreach
You don't need to introduce wordpress, an open-source product. what a famous product is. today I will introduce you to the article that calls a specific wordpress category separately. This function is also very practical in development.

You don't need to introduce wordpress, an open-source product. what a famous product is. today I will introduce you to the article that calls a specific wordpress category separately. This function is also very practical in development.

The call code is as follows:


  • "Rel =" bookmark "title =" ">


45 of the red part is the ID of the classification, and 6 of the green part is the number of display articles.

Note: The above code should not be copied directly to the DW editor or other editors. copy the code to a text document First, remove the original attributes, and then go to the editor.

====================================== Excerpt from related articles ============== ======================================

It is already a simple event for WordPress to get all categories. we can use the "wp_list_categories ()" function, however, if we want to operate on each category, it will be a very difficult event.

After querying a lot of information, I finally found a function that can be used to solve this problem. The "get_categories ()" function returns an array of objects categories that match the query parameters, and "wp_list_categories () "functions are very similar.

Now let's use an example to explain this function.
The following code gets all the categories and displays the latest 10 articles under each category:


Cat_ID; // Get the latest 10 articles under the category query_posts ("showposts = 10 & cat = $ catid");?> "Title =" ">

  • "Title =" ">


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.