Need help with a weird issue I just noticed–maybe tag-related
-
Hoping someone can help me with an issue I recently noticed.
Among other things, I write reviews of Twin Cities, Minnesota restaurants on my blog. I have one page that holds the master list of all my reviews, categorized by genre. This is that page:
https://myannoyingopinions.com/restaurants/eating-out-in-the-twin-cities-and-environs/
All my reviews are tagged by cuisine type and I use iterations of the following code to populate the lists:[display-posts tag="twin-cities-dining" posts_per_page="-1" include_date="true" order="ASC" orderby="title"]
It has always worked and even now seems to be working for every tag except the one listed above, which pulls in links to my “fine dining” reviews. For some reason this list has stopped updating alphabetically after the review that is currently at the bottom of that sub-list (“Tenant XI”). Links to reviews whose titles should alphabetically come after that–Tenant XII, Tenant XIII, Vinai–are not being pulled even though all those review posts also have the “twin-cities-dining” tag assigned to them. However, new reviews posted after “Tenant XI” whose titles are alphabetically before it are showing up as expected in the list. I have no idea why this is happening and would appreciate any help. I would hate to have to go back and re-tag all of those posts in an attempt to fix this.
Thanks in advance for any assistance.The blog I need help with is: (visible only to logged in users)
-
I also tag each review by restaurant name. I just created a test page and used a different iteration of the code above to see if it would pull all the reviews for Tenant plus the one for Vinai if I called specifically for those tags and it works. The first list on this page shows all the Tenant reviews plus the Vinai review with the following code:
Fine/High End Dining
[display-posts tag="tenant, vinai" posts_per_page="-1" include_date="true" order="ASC" orderby="title"]
But, as shown in the second list, if I try to call the “twin-cities-dining” tag as well it not only does not display all the Tenant reviews and the Vinai review, it now stops the list at Tenant X!
A bit of a headscratcher… -
Thanks so much for sharing the details of your setup. I had a closer look, and the reason your list stops partway through is that the
[display-posts]shortcode has a built-in limit of 100 posts. Even if you useposts_per_page="-1", it will not display more than 100 items. (Tenant X, is the 100th item on the list).To work around this, you can split the list into two parts using the
offsetparameter. Here are examples you can copy and try:Part 1 – first 100 items
[display-posts tag="twin-cities-dining" orderby="title" order="ASC" posts_per_page="100" include_date="true"]Part 2 – items 101 to 200
[display-posts tag="twin-cities-dining" orderby="title" order="ASC" posts_per_page="100" offset="100" include_date="true"]If you ever have more than 200 posts, you can repeat this pattern with
offset="200"for the next batch, and so on.Here’s the guide with full details on what the shortcode supports:
https://wordpress.com/support/display-posts-shortcode/ -
Thanks very much! That solution does indeed work. I’ll bookmark this post for when that list crosses the 200 mark in a few years.
-
Glad to hear that did the trick for you! Thank you for being a longtime WordPress user, we really appreciate it.
We look forward to many more of your dining reviews and to celebrating with you when that list reaches 200 posts :)
- The topic ‘Need help with a weird issue I just noticed–maybe tag-related’ is closed to new replies.