Custom search: Search posts but display parent page in results

Ok I have figured it out; added the following to functions.php: add_filter( ‘posts_request’, ‘my_request_filter’, 10, 2 ); function my_request_filter($sql, $query) { if($query->is_main_query() && is_search()) { $sql = “SELECT * FROM wp_posts WHERE post_content LIKE ‘[smoothslider%’ AND post_parent !=’0′”; } return $sql; } I understand that with no access to the database or being able to … Read more

Google Search and Own Website Search?

Why not create a form that submits direct to Google? This would be the simplest solution (assuming you want to search every website in the world): <form action=”http://www.google.com/search” method=”get”> <input type=”text” name=”q” placeholder=”Search Google”/> <input type=”submit” /></form> I believe that would do the job you want it to. The result would look something like: https://www.google.com/search?q=this%20that

Search Woocommerce product titles only

It turns out the free Relevanssi plugin does this rather well. I was afraid it would only search posts and not custom post types, but it does it all… and rather well! It only requires a simple filter added to your theme’s functions.php file to get it to omit the body content: // search titles … Read more

Search through documents folder

get_bloginfo(‘template_directory’) returns a URI and I believe glob works with paths so try: $dir = get_theme_root() . “/documents/*”; foreach(glob($dir) as $file) { echo $file; }

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