Elegant modify WordPress, to realize the number of articles per page Click the tab using a separate set to show the list of articles

Elegant modify WordPress, to realize the number of articles per page Click the tab using a separate set to show the list of articles

Elegant modify WordPress, implement click tags use a separate set number of articles per page to show the list of articles, and cancel summary briefly.

In fact, there is no more elegant, which is compared with the previous article, relative.

Original from: http://ant73.com/276.html

Previous article ( http://ant73.com/269.html ) wrote, how to modify wordpress, click realize a tag cloud (tag cloud) a label, it exhibits all articles under this label. I would have this feature, but because I set in the background of each page displays only one article.

I did not expect this setting affects the display label under the article, here, has become a show only one page articles. I want to achieve 73 per page article, and then over the page.

Therefore, only the previous article, talking about how to achieve this function. Function'd realized, but too simple ah.

Later, I post a message in the wordpress official forum ( https://wordpress.org/support/topic/blog-pages-show-at-most-1-posts-how-to-that-10-posts-in-a an under-Tag--page / # new new-Topic-0 ), for help.

So I went to the roof, exercise dancing flower stick back, I have a master replied. The expert noted

https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

I really solved the big problem here, there are as many sample code is almost directly.

I just changed the number 50 instead of 73, and then a final judgment for the type of conditions to movice deleted.

We can achieve the effect I want. awesome. The following is a specific code and the file path. I want to help you.

Original from: http://ant73.com/276.html

Note that, before the amendment, back up good things related to avoid, you make a mistake, a bad reduction, it is quite embarrassing ah.

The following code, on my blog original text:

http://ant73.com/276.html

Guess you like

Origin blog.csdn.net/metababy/article/details/93460511