Hide/show customizer controls based on other settings in Customizer

you can define the conditional display on definition in PHP with somethign like that : $wp_customize->add_control(“course_instructor_layout”, [ // … other arguments “settings” => “course_instructor_layout”, “active_callback” => function ($control) { return !$control->manager->get_setting(“lmscore_improved_summary”)->value(); }, ]); if that doesn’t work in your case, edit your question to add the complete definition of lmscore_improved_summary and course_instructor_layout.

Remove commas from WooCommerce checkout addresses fields

You can remove/replace comas from address_1 and address_2 billing and shipping fields with the following, once order is submitted (before saving data): // Checkout/Order: Remove/replace comas from adresses fields add_action(‘woocommerce_checkout_create_order’, ‘remove_comas_from_address_fields’, 10, 2 ); function remove_comas_from_address_fields( $order, $data ) { $replacement=””; if ( $billing_address_1 = $order->get_billing_address_1() ) { $order->set_billing_address_1( str_replace( ‘,’, $replacement, $billing_address_1 ) ); … Read more

Toggle nested comments

http://jsfiddle.net/K3gr7/4/ I used an ordered list to markup the comments. You probably need to tweak it to your own setup, and cache some variables for optimization, but the functionality is in there. $(document).ready(function() { // Toggle all $(‘#toggle-all’).click(function() { var $subcomments = $(‘#comments’).find(‘> li > ol’); if ($subcomments.filter(‘:hidden’).length) { $subcomments.slideDown(); } else { $subcomments.slideUp(); } … Read more

Can’t use get_results() in ajax query

This will not work because you call example.com/markers.php directly, and that file does not load anything from WordPress, like the $wpdb object. You can include wp-load.php, but this might break if you move the WordPress installation to somewhere else. To be more in line with how Ajax calls in WordPress should be made, you should … Read more

Enqueuing Script in functions.php vs on the page

Go with functions.php. Use the wp_enqueue_scripts action to call this function, or admin_enqueue_scripts to call it on the admin side. Calling it outside of an action can lead to problems. See #11526 for details. Source: http://codex.wordpress.org/Function_Reference/wp_enqueue_script function themename_load_js() { if ( is_admin() ) { return; } if is_page( 123) { // Replace 123 with your … Read more

Call the content of a page in AJAX in WordPress

I already mentioned in the comments, that there’re preferred ways to load your scripts. The most important is to define the dependencies and the using the proper hooks. The following part won’t work like this: $(document).ready(function() { $(“body”).SEOParallax(); $(“body”).delegate(“a”, “click”, function() { $(‘html, body’).animate({ scrollTop: $($(this).attr(“href”)).offset().top }, 1200); return false; }); }); The WordPress Javascript … Read more