Post Grid plugin (and similar) – Search Parameters
-
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.www.ads-software.com/Class_Reference/WP_Query#Search_Parameter
Which eventually leads to this page: https://developer.www.ads-software.com/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
- The topic ‘Post Grid plugin (and similar) – Search Parameters’ is closed to new replies.