Changing search slug from + to – (hyphen)

PHP’s urlencode() function replaces spaces with +s, so that’s why that’s happening for you. WordPress provides the sanitize_title() function, which is used (among other things) to generate a post slug from the post’s title. /** * Change search page slug. */ function wp_change_search_url() { if ( is_search() && ! empty( $_GET[‘s’] ) ) { wp_redirect( … Read more

Search in Two Categories

Basically you don’t really want search, but separate page that will list post on specific condition? You can create template for a page with Loop that will query for posts, belonging to both categories, using category__and parameter.

More than one search results page template

You could make a page template http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates And then you could post some data via $_GET /search2/?search=xxx to that page and do a custom wp_query where you use ‘s=” . $_GET[“search’] http://codex.wordpress.org/Class_Reference/WP_Query Something like this: $args = array( ‘s’ => $_GET[‘search’] ); $the_query = new WP_Query( $args ); // The Loop while ( $the_query->have_posts() ) … Read more

Alphabetical search

Yes. Do a SQL query for posts using LIKE ‘x%’, where x is your letter. Here’s a simple example: global $wpdb, $post; $letter=”a”; // or $_GET[‘letter’]… $query = “SELECT * FROM {$wpdb->posts} WHERE post_name LIKE %s”; $query = $wpdb->prepare($query, $letter.’%’); $results = $wpdb->get_results($query); // note that variable name must be $post, // because you need … Read more

Display just child pages of a certain page in search results

Try the following approach. Get the page using get_page_by_path() http://codex.wordpress.org/Function_Reference/get_page_by_path $page = get_page_by_path( ‘university-guide’ ); $search_query[‘post_type’] = ‘page’; $search_query[‘post_parent’] = $page->ID; The following snippet was taken from Codex page: Creating a search form http://codex.wordpress.org/Creating_a_Search_Page 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]] = … Read more

Highlight Search Results in Function.php

You can try running the function early so that it runs before the more link is created. add_filter(‘the_excerpt’, ‘highlight_search_term’,1); add_filter(‘the_title’, ‘highlight_search_term’); But I don’t think that solves the deeper problem, even if it were to work. That function is pretty crude and it will replace inside URLs and inside tag attributes, which it should not … Read more

How to disable WordPress Search from Url?

There’s a filter to remove this feature, which is known more commonly as autocorrecting the URL rather than “search” per se. Place this in your site-specific plugin or your custom/child theme’s functions.php file: remove_filter(‘template_redirect’, ‘redirect_canonical’); There is also an old plugin that does this. See https://www.bloggersignal.com/stop-wordpress-from-guessing-urls/ for details.

Any reason why search result lists only one entry?

What template does search page use? It is either generic index.php or specialized search.php. What does Loop in that template look like? I suspect this might be Loop issue that is set to only dislpay single post, instead of iterating all of them.

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