Home> CMS Tutorial> WordPress> body text

How to use multiple screens in one WordPress page

爱喝马黛茶的安东尼
Release: 2019-07-16 10:35:04
Original
1942 people have browsed it

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:

Copy after login

and add the following code after the code:

cat_ID ); ?> 

cat_name; ?>

Copy after login

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();
Copy after login

in step 2 to

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

, 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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!