• Resolved GarrettB

    (@garrettb)


    Hello

    I am using the Post Grid plugin. There are quite a few similar plugins so this question probably applies to them as well.

    Once a Post Grid is set up, there are further option fields in the Query Post section, for example:
    Post Types, Post query order, Posts per page.

    The option field I need to know more about is the Search parameter field.

    The description below this field is:

    Query post by search keyword, please follow the reference https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter

    Which eventually leads to this page: https://developer.wordpress.org/reference/classes/wp_query/#search-parameters

    And its description of the search parameters:

    Search Parameters
    Show posts based on a keyword search.
    • s (string) – Search keyword.
    Show Posts based on a keyword search
    Copy
    $query = new WP_Query( array( ‘s’ => ‘keyword’ ) );
    Prepending a term with a hyphen will exclude posts matching that term. Eg, ‘pillow -sofa’ will return posts containing ‘pillow’ but not ‘sofa’ (available since Version 4.4).

    I have played around with so many different combinations in this field, tyring to do something simple like display the post if its slug is “hello”, so I have entered combinations like:

    $pagename="hello"
    pagename="hello"
    pagename=hello
    “pagename”="hello"
    $query = new WP_Query( array( 'pagename' => hello ) );

    I’ve used single-quotes, double-quotes.
    Instead of pagenames, I’ve used title, Title, page-title, post-title, page_title, post_title, etc.

    In the end, I have no idea how to use this filed.
    If anyone has ANY examples, so I could just see the format required etc.

    Thank you
    Garrett

    • This topic was modified 1 year, 5 months ago by t-p. Reason: Moved to Fixing WordPress from Everything else WordPress
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator t-p

    (@t-p)

    I am using the Post Grid plugin….

    I recommend asking at that plugin’s support so its developers and support community can help you with this.

    Thread Starter GarrettB

    (@garrettb)

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post Grid plugin (and similar) – Search Parameters’ is closed to new replies.