Different layout on search page depending on category post
You can use: if ( in_category(4) ) in order to add different HTML for a post in category 4. This has to be in within the loop for it to work.
You can use: if ( in_category(4) ) in order to add different HTML for a post in category 4. This has to be in within the loop for it to work.
You can use get_posts (Method: get_posts) which returns posts according to WordPress WP_Query parameters and then pass parameters for category and search keyword in cat and s params respectively.
No but I suggest you create a child theme, this will give you full control over the site without affecting the original theme… in there you can create a functions.php page and customize the search from there. you can search for a child theme plugin that can create it for you, and some of them … Read more
There is nothing obviously wrong with the code, assuming you are pushing those arguments through WP_Query, but the query you are trying to run is not going to be very efficient. You have 6 meta values in an ‘OR’ relationship, which is not terribly efficient in itself as all of those rows have to be … Read more
What shortcode should I use for
Custom Search Form WP_Meta_Query – Filtering Custom Fields
I managed to solve this by taking s_ha_dum’s suggestion to use a UNION. It is as follows: (SELECT ID, post_status, post_title, post_excerpt, post_content FROM wp_posts WHERE ((`post_title` LIKE ‘%diamond%’) OR (`post_excerpt` LIKE ‘%diamond%’) OR (`post_content` LIKE ‘%diamond%’)) AND (`post_status` = ‘publish’ )) UNION (SELECT ref, StoreID, Article, subarticle, description FROM wp_hwproducts WHERE (`article` LIKE ‘%diamond%’) … Read more
Custom search results page not showing excerpt
Couple of notes: Your form action is incorrect: <form method=”get” action=”http://www.adoptapet.ie/archive-farm/”>. The page is <form method=”get” action=”http://www.adoptapet.ie/archive-farms/”> You should reorder your argument list for adopt_custom_taxonomy_dropdown(). As written, most of your arguments have default values and can be omitted when the function is called, except that as written argument five doesn’t have a default so you … Read more
Schoolboy error! I was using: $_GET[‘s’]; as opposed to: get_query_var(‘s’); Hence the empty search results. Hope this might help somebody in the future!