Insert DIV container below 1st search result

You should be able to do that with: /** * Setup a custom hook before the second post on the search page */ add_action( ‘the_post’, function( $post, \WP_Query $q ) { if( $q->is_search() && $q->is_main_query() && 2 === $q->current_post ) { do_action( ‘wpse_before_second_post_in_search’ ); } }, 10, 2 ); /** * Inject a Div after … Read more

Template issues getting ajax search results

When you load a template file directly that way, you’re not loading the WordPress environment, so no WordPress functions are available. Your two options are to either load the search page on the front end and filter the result, like: $(‘#results’).load(‘http://mysite.com/?s=searchterm ul#target’); Or build a search function using WordPress provided AJAX functionality, see AJAX in … Read more

Remove meta robots tag from wp_head

add_filter(‘wpseo_robots’, ‘yoast_no_home_noindex’, 999); function yoast_no_home_noindex($string= “”) { if (is_home() || is_front_page()) { $string= “index,follow”; } return $string; } this should be fine i think.. somewhere in your theme functions.php and should do the trick.

How can i move search results onto a specific page?

You created a page with the slug search to “capture” that URL, but WordPress by default already uses that URL for search results. So you were “lucky” that this worked for you, and this is the reason the redirect supermethod mentioned will work. So, instead of creating a “fake” page to hold the template, you … Read more

Empty search input returns all posts

Just an alternative to the informative answer by @PieterGoosen. After Pieter posted this part: if ( ! empty( $q[‘s’] ) ) { $search = $this->parse_search( $q ); } it came to mind that it might be possible to re-parse the search query, within the posts_search filter, for empty search string. But the parse_search() method is … Read more

Display search results within the same page

The simplest option if you want to show search results within a page context you’ll need to do a custom loop, otherwise you won’t be able to access the page information. Change the input with the name s to something else like search or q to stop wordpress from doing it’s usual built in search. … Read more

Extend WordPress search to include user search

You can’t achieve this easily with WP’s built-in search system. Even if you managed to build a complicated query that pulls data from the user table, it would be incredibly slow. Search Unleashed had this functionality, but I’m not sure about compatibility with WP 3.2. I used it in the past as inspiration to add … Read more

How to look at code in WordPress repositories without downloading?

Good news and more good news! First – all of the code related to WordPress itself and its repositories resides in version control system (Subversion). Among other things that makes publicly available sites with all code in plain sight: http://core.svn.wordpress.org/ http://themes.svn.wordpress.org/ http://plugins.svn.wordpress.org/ One not so obvious result of that – if you can see it, … Read more

Limit search to latin characters

This solution filters search strings by applying a regular expression which only matches characters from the Common and Latin Unicode scripts. Matching Latin Characters with Regular Expressions I just had my mind blown over at Stack Overflow. As it turns out, regular expressions have a mechanism to match entire Unicode categories, including values to specify … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)