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

Infinite scroll page number [duplicate]

Here’s the original answer. To sum it up briefly: Build a custom plugin Register a custom script Localize this script to add the data from $GLOBALS[‘wp_query’] – numberposts, posts_per_page and found_posts in it. Write a custom event handler that triggers when the infinite scroll function runs. Here’s a link to the original script in the … Read more

How to change links in the 3 main categories, on widget category, to a javascript function call

The Answer is: $(document).ready(function() { $(“#f-submenu”).hide(); $(“#m-submenu”).hide(); $(“#i-submenu”).hide(); $(“.widget ul li > a:not(ul li ul li>a, ul li+li ul li>a,ul li+li+li ul li>a )”).attr(“href”, “javascript:hideMenu();showSubMenu(‘m-submenu’)”); $(“.widget ul li+li > a:not(ul li ul li>a, ul li+li ul li>a,ul li+li+li ul li>a )”).attr(“href”, “javascript:hideMenu();showSubMenu(‘f-submenu’);”); $(“.widget ul li+li+li > a:not(ul li ul li>a, ul li+li ul li>a,ul li+li+li … Read more

adding the full image path to a wordpress javascript file

well first of all, don’t directly inject a script tag like that, use wp_enqueue_script to add your javascript file. additional data can then be passed from php to javascript via the wp_localize_script function. function wpa_scripts() { wp_enqueue_script( ‘wpa_script’, get_template_directory_uri() . ‘/js/script.js’, array(‘jquery’), null, true ); $script_data = array( ‘image_path’ => get_template_directory_uri() . ‘/images/’ ); wp_localize_script( … Read more