WP Media uploader loading only once in options page

The reason for the media uploader not opening when clicking the second button is that both of your buttons have the same ID, which you are also binding to the function that open your uploader. Element IDs should always be unique, hence the .click function listener will only detect when user clicks the first button … Read more

Can’t move jQuery to footer

Not the best way but removing the default WordPress actions that allow any scripts in the document’s head can help: function md_footer_enqueue_scripts() { remove_action(‘wp_head’, ‘wp_print_scripts’); remove_action(‘wp_head’, ‘wp_print_head_scripts’, 9); remove_action(‘wp_head’, ‘wp_enqueue_scripts’, 1); } add_action(‘wp_enqueue_scripts’, ‘md_footer_enqueue_scripts’);`

validate a metabox based on the category that is selected

Apologies for the delay – what I did was basically created a .js file and places it within my theme folder – for example themes/nameoftheme/custom/checkcode.js Then using jquery – I created my code – here’s a snippet: jQuery(‘#in-category-6’).click(function(){ jQuery(‘#metabox_one’).toggle(this.checked); jQuery(‘#metabox_two’).hide(); jQuery(‘#metabox_three’).hide(); jQuery(‘#in-category-3’).attr(‘checked’, this.checked); jQuery(‘#in-category-1’).attr(‘checked’, false); jQuery(‘#in-category-4’).attr(‘checked’, false); jQuery(‘#in-category-5’).attr(‘checked’, false); jQuery(‘#in-category-7’).attr(‘checked’, false); jQuery(‘#in-category-8’).attr(‘checked’, false); jQuery(‘#in-category-9’).attr(‘checked’, false) … Read more

Add colorpicker to featured image

Okay. Got it working…. I used the simple version: add_filter( ‘admin_post_thumbnail_html’, ‘basic_add_opacity_to_feature_thumb_box’); //same as before function basic_add_opacity_to_feature_thumb_box( $myhtml ) { $selected_option = get_post_meta( get_the_ID(), ‘basic_opacity’, true ); // get the current value for ( $i = 0; $i <= 1; $i = $i + 0.1 ) { //loop from 0 to 1 in 0.1 increments … Read more

how to get the comment ID in the front end when the REPLY button is clicked?

Here are few ideas: It’s possible to inject custom HTML or data attributes via the comment_reply_link filter, but I think it would be better to keep it unobtrusive. One could try to get the comment parent value from the reply comment form: <input type=”hidden” name=”comment_parent” id=’comment_parent’ value=”0″ /> after it has been updated with the … Read more