How to send email in wordpress with more than one attachments

Don’t know if that will solve all your problems, but: Generally nicely formatted code is easier to debug. E.g. your code is missing the closing brace. Besides it is better to write if/else(if) statements with braces. Nice indentation helps too. I’d suggest reading the WordPress – PHP Coding Standards. Regarding your code: As noted at … Read more

Filter, or any way to dynamically change theme screenshot image?

From quick look WP seems to process array of theme data in a way that is used for both PHP and JS sides. Result passes through wp_prepare_themes_for_js filter, which seems like a suitable place to override screenshot URL as necessary. This worked in my dev install: add_filter( ‘wp_prepare_themes_for_js’, function ( $themes ) { $themes[‘r-test’][‘screenshot’][0] = … Read more

Problem with is_active_sidebar?

Please try this one,because without id we i don’t think that will work: function reg_l_sid() { $args = array( ‘id’ => ‘sidebar-footer-6’,’name’=> ‘Left-sidebar’); register_sidebar($args); } add_action(‘widgets_init’, ‘reg_l_sid’); and inside template: if (is_active_sidebar(‘sidebar-footer-6’)) { dynamic_sidebar(‘sidebar-footer-6’); } else { echo ‘Please add widgets’; }

How to run an add_action hook for specific page

Put is_page() inside the callback function: function include_regForm_validation() { wp_register_script( ‘jQuery_form_validation’, ‘https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.js’,array(‘jquery’), ‘1.0’, true ); if ( is_page( ‘login’ ) ) { wp_enqueue_script( ‘jQuery_form_validation’); } } add_action( ‘wp_enqueue_scripts’, ‘include_regForm_validation’ ); WordPress has not determined what page/archive has been requested yet when hooks are added with add_action(), so you need to make the determination only when … Read more

Ensure function has completed before allowing another Ajax call

I usually use CSS classes to control AJAX requests affecting a specific element. This way you can prevent unwanted AJAX requests on that element, while other AJAX requests may still be triggered, being bound to other elements. $(‘.slot’).on(‘click’, ‘a.book’, function(e) { e.preventDefault(); // Check if doing ajax if($(this).hasClass(“doing-ajax”)) return false; $(this).addClass(“doing-ajax”); var user = $(‘#rjb_day’).attr( … Read more