Home › Forums › Pro Support › Show Posts by Tag
Tagged: ORDER by tag
- This topic has 14 replies, 3 voices, and was last updated 3 years, 1 month ago by
VALENTINO.
-
AuthorPosts
-
May 9, 2020 at 3:13 pm #15434
Protagonista
ParticipantHi Tom,
We are a media company that are contemplating in migrating our site to GeneratePress and WP Show Posts (we already bought your tools). However, for us it is important that at the end of each article, there are related posts filtered by Tags. We currently have 11637 articles and 555 tags.
We want to create a list for each tag on our site, and then add the shortcode through an element (hook).
That said, at least we will have 555 lists and 555 hooks. Our question is whether this could slow down the site or if there is a more optimal way to do it. Our main intention to use your tools is the performance of the site.
Thank you very much for your help,
Daniel
May 12, 2020 at 4:49 pm #15500Tom
KeymasterHi Daniel,
I would definitely advise against adding that many lists.
What will the lists do, exactly? Show posts from the same tag as the current post? What if there is more than one tag?
Let me know 🙂
August 10, 2020 at 5:37 am #18106VALENTINO
ParticipantHi, we need the same thing. I have both theme and PRO plugin. I have created a list which I show below the post. In “more setting” of the list I have no ORDER by TAG. How can I add it? Thank you!
August 10, 2020 at 1:53 pm #18132Tom
KeymasterHi there,
What will the lists do, exactly? Show posts from the same tag as the current post? What if there is more than one tag?
August 10, 2020 at 2:01 pm #18137VALENTINO
ParticipantExactly: Show posts from the same tag as the current post (there will only be one tag). In case there are no tags the normal current post per category. Missing a TAG filter would be very handy. 🙏
Thanks for the reply.August 11, 2020 at 4:39 pm #18172Tom
KeymasterYou would need to use the PHP function in a hook:
For example:
$tags = get_the_tags(); $tag_slug = $tags[0]->slug; wpsp_display( 123, 'tax_term="' . $tag_slug . '"' );
You just need to hook that into single posts and update
123
with the ID of the list.August 13, 2020 at 4:23 am #18222VALENTINO
ParticipantThanks for your code.
Ok I added the code, and put ID of the list 731 (see attached photo).
Result: “Sorry, no posts were found.”
But the TAGs are there on more articles.
The taxonomy I have left blank. (see photo). please it is important for news sites.
🙏🙏🙏🙏August 13, 2020 at 10:17 am #18227Tom
KeymasterCan you try giving the list the proper taxonomy?
If that doesn’t work, try adding
var_dump($tag_slug)
after line 6. Does it output anything?August 13, 2020 at 11:13 am #18235VALENTINO
Participanttried, and his answer is
string (0) “”
August 13, 2020 at 2:55 pm #18244Tom
KeymasterCan you try the updated code?: https://wpshowposts.com/support/topic/show-posts-by-tag/#post-18172
August 13, 2020 at 3:16 pm #18247VALENTINO
ParticipantNew code applied and added var_dump ($ tag_slug):
He writes to me:
“Sorry, no posts were found.”
“string (5)” other ”OTHER is the right TAG! Other posts with the same tag are not seen.
Does it work on your wordpress test? Theoretically it should work, the tag is right.
August 14, 2020 at 12:22 pm #18275Tom
KeymasterDid you add the correct taxonomy in the list settings UI?
August 14, 2020 at 11:05 pm #18289VALENTINO
ParticipantWorks perfectly, generic TAG taxonomy (without clicking anything).
Thank you very much!
Great assistance!
August 16, 2020 at 9:54 am #18323Tom
KeymasterGlad I could help 🙂
August 16, 2020 at 10:27 am #18329VALENTINO
Participant🙏🙏🙏
-
AuthorPosts
- You must be logged in to reply to this topic.