How can i display wath i am searching in a theme

Add the following code to your template’s search.php – somewhere before the loop: <?php global $wp_query; echo ‘Your results retrive (‘.$wp_query->found_posts.’ posts) with the subject ‘.get_search_query().’.’; ?> If search.php does not exists in your template’s directory, either copy archive.php (if it does not exists too, copy index.php – see template hierarchy) and rename it to … Read more

Search results from a specific database table

You’ll likely need to your the $wpdb object. Learn about it on the WordPress Codex. Check out the Custom Database Tables series on WPTuts+ as well. Lots of really good information about when to use custom database tables, and how to access them efficiently, securely and with WordPress best practices. The series should teach you … Read more

How to display search query as formatted text?

You’ll probably want filter out some parameters, change the order they’re displayed, etc – but this should get you started: $s = “/?s=Search&property_city=las-vegas&property_location=Nevada&min_price=20000&max_price=500000&beds=2&baths=3&min_area=1000&max_area=1000000&property_type=apartment&s=Search&apor=Any&apvr=Any&post_type=property”; parse_str($s,$parts); foreach ($parts as $key => $value) { $name = ucwords(str_replace(“_”,” “,$key)); echo “$name: $value<br />\n”; } You can probably just use foreach ($_REQUEST as $key => $value) { unless there’s a … Read more

How to get only post=’product’

If I understand you, what you are doing is wildly complicated. All you should need is a simple pre_get_posts filter: add_filter( ‘pre_get_posts’, ‘modified_pre_get_posts’ ); function modified_pre_get_posts( $query ) { if ( $query->is_search() ) { $query->set( ‘post_type’, ‘product’ ); } return $query; } Plus your filter that adds DISTINCT. post_type is a query parameter rolled into … Read more

How do I find a shortcode stored in wordpress?

not sure if this helps but https://en.support.wordpress.com/shortcodes/ has a list of shortcodes available within WordPress. remember that themes may add additional codes. I’ve tried to format my reply so the codes are on separate lines but can’t work out how to do it. If someone could edit my answer/format it so I can learn that … Read more

Limit search to posts and pages

and add this to functions.php if you want to search only in posts and pages. function mk_searchfilter($query) { if ($query->is_search && !is_admin() ) { $query->set(‘post_type’,array(‘post’,’page’)); } return $query; } add_filter(‘pre_get_posts’,’mk_searchfilter’);

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