• Resolved Aims

    (@amyaturnerwp)


    Hello,

    I’ve been using Relevanssi on HealthyWork.org for a few months to highlight search keywords in the result content. That works well.

    Now I’m trying to use the Relevanssi shortcode [searchform post_types=”post”] to restrict the search form on the blog page (HealthyWork.org/healthy-work-blog/) to only search posts. But it’s not working.

    Strangely, the regular shortcode [searchform] is working fine.

    I’m currently using Relevanssi v4.4.1.

    My site’s theme is Divi.

    I’ve searched this forum for answers and tried the suggestions to no avail.

    Here are some of my Relevanssi settings:
    – dlm_download excluded from search
    – category and post_tag indexed
    – Custom fields: none (I’m not using any, that I know of)
    – Index the post excerpt: yes
    – Expand shortcodes: yes

    I’ve clicked “Index unindexed posts” already and clicked “Build the index” several times”

    I also tried unchecking “Expand shortcodes” and rebuilding the index and that didn’t work.

    I tried to find a search.php or searchform.php or query_posts() in tons of different theme files (Divi), but didn’t find anything like that.

    Thank you for your assistance.

    Amy

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    When reporting problems like this, please explain how it’s not working. Just “it’s not working” doesn’t really tell me anything.

    Anyway, I did take a look at your site and noticed the post type parameter is like this in the form:

    <input type="hidden" name="post_types" value="”post”">

    Those double quotes are what makes it not work.

    You now have

    [searchform post_types=”post”]

    Change that to

    [searchform post_types="post"]

    and it’ll work better (it’s not particularly obvious when you look at the text with the font used on the forums, but the quotes are different: in the first one they’re curly and in the correct one they’re straight).

    • This reply was modified 6 years, 2 months ago by Mikko Saari.
    Thread Starter Aims

    (@amyaturnerwp)

    Thank you. That solved the problem. I appreciate your help and fast response.

    One question though regarding your comment “When reporting problems like this, please explain how it’s not working. Just “it’s not working” doesn’t really tell me anything.”

    I actually thought I did explain it in my support question. I provided a bunch of info I thought might help in knowing where the source of the problem might be and explained things the best I could while not knowing what was causing the issue.

    So out of genuine curiosity, what could I have added that would have told you more in terms of explaining “how” it wasn’t working? So I know for next time in a forum.

    Thanks again, Mikko.

    Plugin Author Mikko Saari

    (@msaari)

    You did tell me lots of background information, which is definitely more than most people do, but not the actual plugin behaviour. How exactly was it not working? What behaviour did you expect, what behaviour did you get?

    I’m guessing in this case the way it wasn’t working was that the filter did not actually filter the post and the search just returned all post types? But that exact detail is not mentioned, and that is the most important thing. “It’s not working” can mean so many different things, and knowing what is the exact aspect and behaviour that is not working is crucial.

    Thread Starter Aims

    (@amyaturnerwp)

    Ah, that totally makes sense. Thanks for the detail on that, Mikko! Helps for next time.

    Thanks again for the fast response time, for the simple solution, and the plugin!

    Much appreciated.

    Amy

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Relevanssi Shortcode post_type=”posts” not working’ is closed to new replies.