Click loads template via ajax
So, you’re using wp_localize_script to inject the ajax url. But you didn’t use the localized var handle to access that value. Try this: /* … */ $.ajax({ url: ajaxStuff.ajaxurl, // NOTE use of ‘ajaxStuff’ object /* … */
So, you’re using wp_localize_script to inject the ajax url. But you didn’t use the localized var handle to access that value. Try this: /* … */ $.ajax({ url: ajaxStuff.ajaxurl, // NOTE use of ‘ajaxStuff’ object /* … */
You can wp_enqueue_script in your shourtcode. Here are the code I fixed. Register your JS file function wh_enqueue() { wp_register_script( ‘wh-ajax-app’, WH_PATH . ‘/js/write-here-ajax.js’, array(‘jquery’), ‘1.0.0’, true ); } add_action( ‘wp_enqueue_scripts’, ‘wh_enqueue’ ); and enqueue in your shortcode function function ajax_write_here(){ wp_enqueue_script( ‘wh-ajax-app’ ); // Enqueue your script here $output=”<div id=”write_here_ajax_wrap”></div>”; return $output; } add_shortcode(‘write-here-ajax’, … Read more
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
That’s called Thickbox. Since you give no clue what you want to use it for, you’ll have to figure out the rest for yourself…
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
WordPress loads jQuery because plugins and themes suppose it does. If you want another version of jQuery for your theme, there is a risk that plugins you may be using will not work, since (if they are maintained well) they are designed to work with default jquery. That said, if you insist on using your … Read more
This whole thing works as far as I can tell. In the future it may be easier to debug things by using PHP error_log() to write to the debug.log at certain points, like inside your ajax callback. If you’re only wanting to run this ajax for logged in users, you can drop the wp_ajax_nopriv hook … Read more
You can use the script_loader_tag hook function enqueue_validation_script() { wp_register_script( ‘validation’, ‘https://www.asd.in/script.php?id=3ff00a469474bbe71a9218a7f0377518’, array( ‘jquery’ ) ); wp_enqueue_script( ‘validation’ ); } add_action(‘wp_enqueue_scripts’, ‘enqueue_validation_script’); function add_id_to_validation_script( $tag, $handle, $src ) { if ( ‘validation’ === $handle ) { $tag = ‘<script type=”text/javascript” id=”3ff00a469474bbe71a9218a7f0377518″ src=”‘.$src.'”></script>’; } return $tag; } add_filter( ‘script_loader_tag’, ‘add_id_to_validation_script’, 10, 3 );
There’s two problems: You’re not sending the AJAX request to the correct URL. You’re using PHP-style concatenation instead of JavaScript. For the first issue, a relative URL “admin-ajax.php” is not going to work. If you are on a page like /about-us/ then jQuery is going to send the request to /about-us/admin-ajax.php, which doesn’t exist. The … Read more
To use a custom control, you need a field with special attributes to be linked to the “publish” button. if you don’t want to display this field, you can generate a hidden field like that : class WP_Test_2_Customize_Control extends WP_Customize_Control { public function render_content() { ?> <input id=”<?php echo htmlspecialchars(“_customize-input-{$this->id}”);?>” type=”hidden” <?php $this->input_attrs();?> <?php if … Read more