Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Resolved] Show Posts by Tag

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Show Posts by Tag

Tagged: 

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #15434
    Protagonista
    Participant

    Hi 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

    #15500
    Tom
    Keymaster

    Hi 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 🙂

    #18106
    VALENTINO
    Participant

    Hi, 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!

    #18132
    Tom
    Keymaster

    Hi 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?

    #18137
    VALENTINO
    Participant

    Exactly: 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.

    #18172
    Tom
    Keymaster

    You 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.

    #18222
    VALENTINO
    Participant

    Thanks 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.
    🙏🙏🙏🙏post per tag

    #18227
    Tom
    Keymaster

    Can 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?

    #18235
    VALENTINO
    Participant

    tried, and his answer is

    string (0) “”

    #18244
    Tom
    Keymaster
    #18247
    VALENTINO
    Participant

    New 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.

    #18275
    Tom
    Keymaster

    Did you add the correct taxonomy in the list settings UI?

    #18289
    VALENTINO
    Participant

    Works perfectly, generic TAG taxonomy (without clicking anything).

    Thank you very much!

    Great assistance!

    #18323
    Tom
    Keymaster

    Glad I could help 🙂

    #18329
    VALENTINO
    Participant

    🙏🙏🙏

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.