WordPress Home Page does not display the method of specified categories of articles

Time:2019-8-12

This article describes an example of how WordPress homepage does not display a specified category of articles. Share for your reference. Specific analysis is as follows:

Sometimes we don’t want all the classified articles to be displayed on the home page. Most of them just want to show some articles that I think are important on the home page. Now let me introduce the implementation method of WordPress homepage which does not show the specified classified articles. Friends in need can refer to it.

If you don’t want to display a categorized article on the home page, just use this code:

Copy code

The code is as follows:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Equivalent to the traditional left bracket next sentence

Copy code

The code is as follows:

<?php if (is_home() && in_category(‘1’) ) continue; ?>

Change 1 to the ID you specify for the category, I to the category name in the background, and the status bar displays the ID.

I hope this article will be helpful to the construction of WordPress.