You can use the cat parameter to get the shortcode to list the most popular posts from a specific category ID, like so for example:
[wpp cat='25']
See Parameters for more details.
I use the following code. Please see if everything is correct. And how do I add a category here?
[wpp post_type=post limit=5 wpp range='last1days' wpp range='custom' time_quantity=1 time_unit='day' wpp_start='<ol class="wpp-views">' wpp_end='</ol>' wpp_start='<ol class="wpp-list">' wpp_end='</ol>' stats_taxonomy=true wpp cat='14']
-
This reply was modified 1 year, 3 months ago by
vlvshein.
I did this. Posts from all categories are displayed, but only 14 categories are needed.
You have “wpp” multiple times in your shortcode which is probably confusing WordPress. The parameters range, wpp_start and wpp_end are duplicated too. stats_taxonomy needs to be either 1 or 0 so I fixed that too.
Here’s the revised version:
[wpp post_type='post' limit=5 range='custom' time_quantity=1 time_unit='day' wpp_start='<ol class="wpp-list">' wpp_end='</ol>' stats_taxonomy=1 cat='14']
Is 14 the ID of your category?
Yes, 14 and 22 are category id
I inserted your code. Posts from all categories are displayed.
Alright, where’s your shortcode exactly so I can have a look?
The widget with the code is located on the main page. rifmo.ru . I showed it in the screenshot. There is 1 post under the number, which should not be displayed in the widget. He is in another category #77.
https://ibb.co/5tg6XPS
That’s odd. Would it be possible for you to provide a copy of the following database tables so I can test myself and see what’s going on?
- wp_options
- wp_popularpostsdata
- wp_popularpostssummary
- wp_popularpoststransients
- wp_postmeta
- wp_posts
- wp_termmeta
- wp_terms
- wp_term_relationships
- wp_term_taxonomy
Where can I send you copies of the database?
I have sent you an email.
Issue resolved. OP was editing the wrong shortcode π