Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    If your posts have specifically defined tags, you could try this:

    [loop type="post" tag="featured"]
        [comments]
    [/loop]

    If you mean searching through posts for a keyword, this may work:

    [loop type="post" s="search term"]
        [comments]
    [/loop]
    Plugin Author Eliot Akira

    (@miyarakira)

    However, depending on the number of posts you have, searching for a key word could be heavy on the processing.

    Thread Starter Alin Ionut

    (@c3dry2k)

    everything works perfect, but now I want to know is I can retrieve a custom message if there’s no comment in any article with that specific tag.

    Plugin Author Eliot Akira

    (@miyarakira)

    Sorry, I didn’t see your reply until now!

    Do mean that you would like to display a message when there are articles with that tag, but none of them have comments? Hmm, that’s a tricky one – if this is the case, it will have to be an additional function inside the loop.. Something like:

    [loop type="post" tag="featured"]
        [comments]
        [no-comments]
            There are no comments.
        [/no-comments]
    [/loop]

    However, this will display the “no comments” message for every article that’s found.

    Maybe it could be like:

    [loop type="post" tag="featured" if="all-no-comments"]
        There are no comments for any featured articles.
    [/loop]

    Would that solve your question? If so, I can add that parameter for the next update.

    Thread Starter Alin Ionut

    (@c3dry2k)

    No, it’s retrieve as you say, 1 message for every post. I need just one message if there is no article with at least 1 comment.

    Plugin Author Eliot Akira

    (@miyarakira)

    Please see update to version 0.4.4. I added the parameter if=”all-no-comments”. You can use it just like in the last example I described – let me know how it works for you.

    Thread Starter Alin Ionut

    (@c3dry2k)

    now it display just one text if there’s no comments in an article but if there are comment it’s display blank.

    Plugin Author Eliot Akira

    (@miyarakira)

    Yes, when the parameter if=”all-no-comments” is set, the loop shortcode displays the message once, only if there are no comments for any of the posts found.

    For example:

    [loop type="post" tag="featured"]
        [comments]
    [/loop]
    [loop type="post" tag="featured" if="all-no-comments"]
        There are no comments for any featured articles.
    [/loop]

    The first part displays comments from posts with the tag featured, and if there are no comments in any of them, the second part will display a message.

    Or did you want to do something different..? If so, please describe more in detail, and I can see what’s possible.

    Thread Starter Alin Ionut

    (@c3dry2k)

    With a second loop it’s working, but I want to place it in the same loop.

    Plugin Author Eliot Akira

    (@miyarakira)

    To display only one message when there are no comments, I can’t put it together with the same loop that displays comments for each post. So, the only way it’s possible is to use two loops, one for comments, another for no comments.

    I hope you can make this work for your needs – if you have an idea for a better solution, please let me know.

    Thread Starter Alin Ionut

    (@c3dry2k)

    I solve the problem. Thank you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘coments form post by tag’ is closed to new replies.