Home>Article>CMS Tutorial> How to use multiple screens in one WordPress page

How to use multiple screens in one WordPress page

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-07-16 10:35:04 1950browse

How to use multiple screens in one WordPress page

Let WordPress display all categories of articles on one page

1. Copy a page.php file and change it to page -abc.php, and create a new page in the WordPress background, and change the fixed link address to abc (this abc can be optional, but it must correspond to page-abc). PS: If you don’t know how to create a new page, please refer to "How to Create a WordPress Custom Page".

2. Find the following code in this page-abc.php file:

and add the following code after the code:

cat_ID ); ?> 

cat_name; ?>

Remember to save and update page-abc .php files.

Related recommendations: "WordPress Tutorial"

At this point, let’s refresh the abc page we just created to see if the articles under all categories have been displayed? The above code displays 10 articles in each category by default. If you need to display all articles, you only need to change the 10 in the code to a value of 1000 or greater.

Let WordPress display articles in several categories on one page

The implementation method of displaying articles in several categories is the same as the method of displaying articles in all categories, except You need to change the code

$cats = get_categories();

in step 2 to

$cats = get_categories(array('include' => '1,2,3'));

, where 1, 2, and 3 are the category IDs you want to display.

The above is the detailed content of How to use multiple screens in one WordPress page. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn