How to search pdf attachment?

I would recommend you first to search attachments by your search term. For example: $attachments_query = new WP_Query( array( ‘s’ => ‘Your search query’, // <– Your search term ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘application/pdf’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ) ); With this query, you will get all PDF files that fit your … Read more

Search Results with googlemaps

@Richard, it’s hard to answer this in detail with this little details. Do you need to pinpoint a single house? Will you use an address or will you use latitude and longitude? My suggestion would be to take a look at this excellent Google Maps Plugin for jQuery. jQuery is part of any WordPress installation, … Read more

how can I make the search return only single random correct result?

For a relatively small number of posts, you could try the following: /** * Return a single random search result */ add_action( ‘pre_get_posts’, function( \WP_Query $q ) { if( ! is_admin() && $q->is_main_query() && $q->is_search() ) { $q->set( ‘posts_per_page’, 1 ); $q->set( ‘orderby’, ‘rand’ ); } } ); where we modify the main front-end search … Read more

Search options/filters

First things first: the name attribute for your “All Words” checkbox shouldn’t be ‘s’. That replaces the search text with “1”, so when that’s checked, you’re searching for “1”, not for the search text. I don’t think you want to use ‘exact’ if you’re looking to replicate the example you gave in your question. Here’s … Read more

Putting Text in the Search Box. eg- “Search My Site” [closed]

From the Codex Docs: The is_search() Conditional Tag checks if search result page archive is being displayed. This is a boolean function, meaning it returns either TRUE or FALSE. <?php $search_box_term = is_search() ? get_search_query() : ‘DEFAULT SEARCHBOX STRING’; ?> <input type=”text” value=”<?php echo $search_box_term; ?>” name=”s”> So this ↑ shows either DEFAULT SEARCHBOX STRING … Read more

WordPress search form and input type=”image”

You have to use javascript or jQuery for this form. You can use like this: <!– Custom Style for the form –> <style type=”text/css”> body { margin: 0; padding: 30px 0; font-family: arial; font-size: 16px; line-height: 22px; max-width: 800px; margin: 0 auto; overflow: hidden; } body:after { content: ”; clear: both; display: table; } img{ … Read more

Search redirects to index

The problem was due to htaccess file that was in the root directory. **`.htaccess`** DirectoryIndex start.php This was causing all of the index.php files to be changed to start.php. This filr did not exist in my wordpress directory. When I renamed the index.php to start.php in the wordpress installed sub directory the search started to … Read more

Search query with quotes

using the \’ escape works for me, so whatever is causing your issue is something else with your website. I checked with the code below: $the_query = new WP_Query( [‘post_type’ => ‘post’, ‘s’ => ‘Hello\’s’] ); if ( $the_query->have_posts() ) { echo ‘<ul>’; while ( $the_query->have_posts() ) { $the_query->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; … Read more

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