Tag Info

New answers tagged

0

Ok i manged to create the solution by finding that LIKE condition can be used in meta query. so here is the final code.. $args=array( 'post_type' => 'tyre', 'post_status' => 'publish', 'tax_query' => array( array( 'taxonomy' => 'tyre-category', 'field' => 'ID', //can be set to ID 'tag' ...


0

In my case I use a custom query so I can just use: $query = new WP_Query(array('post_type' => 'akteur', 'meta_query' => array( 'relation' => 'OR', array('key' => 'wpcf-kurzbeschreibung','compare' => 'LIKE','value' => $suchbegriff), array('key' ...


0

After further testing, the problem was found to be caused by another filter, posts_where, which was registered to support searching also in custom fields, and that's why only searching is affected. Originally it generates something like this, so if the OR statement returns true (when one of the custom fields includes foo), that post will appear on the ...


0

Tom, You're right! I didn't know how templates function, this was not something major, I just wanted to get that value and then display that value on my single.php page - but now I see that's not how WordPress works. I decided to just leave off that functionality :-) Thanks, Josh


0

I created an if statement to solve my problem: <? if (stripos(wp_get_referer(), "cat=")!==false) { echo "Came from Search"; } else { echo "Didn't come from Search"; } ?> I am doing a category search, so I check to see if cat= is in the referrer url (or search url), if it is I execute some code, if not I execute some ...


1

You could hook into the the_permalink filter and check for is_search() to conditionally modify the URLs of your search results to include some additional parameters that your single.php then checks for. Something like this (may require tinkering): add_filter( 'the_permalink', 'wpse155331_the_permalink' ); function wpse155331_the_permalink( $url ) { if ( ...


0

You can try modifying your query using pre_get_posts filter. function mod_query() { if ($query->is_main_query() && !is_admin() && is_search()) { // test print queried search terms print_r( $query->query_vars['s'] ); $search_terms = $query->query_vars['s']; $search_terms = preg_replace('/\s+/', '+', ...


0

Some themes like Twenty Fourteen include a template tag included in the content.php file for entry meta which includes the author and date: Example: twentyfourteen_posted_on(); The content.php file also includes the_title() tag so you need to remove that if you don't want the entry titles displaying on your search result pages. The search.php file ...


0

You are slightly confusing $wp_query global variable with WP_Query class/objects. $wp_query is an object instance of WP_Query, but not every WP_Query object has anything to do with $wp_query global. Function version of conditionals, such as is_search(), always act on main global query. You shouldn't use them inside filters, since global state might be one ...


0

For now I've just redirected the default search string (www.sitedomain.com/?s=keyword) to www.sitedomain.com/trade/keyword, (trade is my custom taxonomy) although I'm pretty sure this isn't the correct or best way to do it so it'd be great if someone else has a better solution. Here is the code for redirecting the search string: function redirect_search() { ...


0

You get all terms because you're asking for all terms, in fact, the line $tradeList = get_terms('trade'); just get all the terms, ignoring the 'term' query string passed to file. If you want to get all the terms "filterd" you have to use the string in the query, something like: include_once( '../../../wp-load.php' ); // adjust the path, of course // or ...


-1

Use Relevanssi ( https://wordpress.org/plugins/relevanssi/ ). If you have a large database then swiftype is better option.


0

Try adding the following code to the top of your search.php template below the get_header() call: <?php global $query_string; $query_args = explode("&", $query_string); $search_query = array(); foreach($query_args as $key => $string) { $query_split = explode("=", $string); $search_query[$query_split[0]] = ...


1

Your search form includes this: <input type="hidden" name="post_type" value="postpage" /> So when your search page loads, the query variable 'post_type' is set to load posts of type 'postpage'. Since posts are of type 'post' and pages are of type 'page', neither of which are 'postpage', you do not get what you expected. Next time, don't use ...


2

The easiest way: create a page template that only includes the search form (get_search_form()) create a page and assing the template In the href attrib of the iframe, instead of put the url for searchform.php put the url of the page Pretty easy, but you need a query to get the page. A more performant way is to use fancybox without iframe, but via ajax, ...


0

This is a little tricky, because "line" is far from simple complex. Is it a plain text line? Is it a HTML paragraph? Is it a line of a paragraph? What if it matches more than once in line? It would be impractical to try express this in SQL and integrate with query results. For these requirements I would just manipulate full content returned inside the ...


0

Well you can try to do while(have_posts()) - a standard query loop in your search page. Than you can try to highlight (in example its marking a search occurance of the search string), but you can modify example and show only your search word occurance. function sublinhamos($text, $words) { $wordsArray = array(); $markedWords = array(); // ...


0

okay sorry for mentioning only link as an answer.. if first pagination link shows 404 error that should be a permalink issue. but to u its second page so definitely it because of some code mistake. please check this code. /*Loop Pagination - A WordPress script for creating paginated links on archive-type pages.*/ function loop_pagination( $args = array() ...


0

.animate() is the jQuery function you're going to want to have a look at. Very handy. Here's a working example for your particular question: http://jsfiddle.net/B8Yv9/ And a complete html workup: <!doctype html> <html> <head> <meta charset="utf-8"> <script type='text/javascript' ...



Top 50 recent answers are included