saw a WordPress blogger today asking, "how does the WordPress blog front exclude the specified category?"". There are many reasons why users want to do this. Maybe you don’t want to display the articles of your life on the home page, but only show some news articles.
loop; to do this, you need to change the function of the call article in The. The WordPress default topics Twenty, Ten, and Twenty Eleven use the the_post () function to call all blog posts.
< PHP while (have_posts ()): the_post (); >
the_post () function uses WP_Query. We can use the WP_Query function itself to customize which articles are called, or which archives, categories, and time articles can be displayed on the home page.
additionally, we can use the query_posts function to control the The Loop loop. This method is undoubtedly the best because it does not change your cycle. But I’ll explain the two ways, and you can choose one that suits you.
uses function WP_Query
if you want to change your home page display effect, you need to edit your subject index.php file. Most topics use the archive.php file as the display page of category, date, and tag, so you want to change an archive page as long as you modify the archive.php file. There are also topics that have special category.php, date.php, and tag.php templates, and modify the corresponding ones.
most themes file cycles start with "Start the Loop". For example, in the Twenty Eleven theme, it looks like this:
< PHP Start the Loop * / / *?? >
you need to replace the following function:
/ The Query>