Why jquery option is not working when pass value using wp_localize_script?

My first guess is that the values aren’t the correct “type”. Meaning you might be passing string values when the script expects integers, so try converting the values to integers first. jQuery(document).ready(function(){ var newsPerPage = parseInt( newsbox_parameters.newsPerPage ); var newsTickerInterval = parseInt( newsbox_parameters.newsTickerInterval ); jQuery(“.news_list”).bootstrapNews({ newsPerPage: newsPerPage, autoplay: true, pauseOnHover: true, navigation: false, direction: ‘down’, … Read more

Accessing an API with jQuery and AJAX

There are a few things going on with your functions.php file that may be the issue. You should be using wp_enqueue_scripts action to enqueue your script. The first parameter of wp_localize_script() should match the id of the file you’ve enqueued. You also need to add a no_priv version for your Ajax call if it needs … Read more

echo do_shortcode for Contact Form 7 from within dynamically loaded php file

From what you have shown, downloadform.php never loads WordPress, hence naturally do_shortcode() is not available. You need to implement your AJAX using this Codex article: http://codex.wordpress.org/AJAX_in_Plugins Another alternative I would suggest is loading the contact form in a hidden div during the initial page load and then display the hidden div when users click whatever … Read more

admin ajax php success returns 0

Add die(); to the end of the function handle ajax. Add return false; after jQuery.ajax function tw_pages_results() { //stuff die(); } jQuery(document).ready(function() { jQuery.ajax({ type : “post”, dataType : “html”, url : “<?php echo site_url(); ?>/wp-admin/admin-ajax.php”, data : {action : “tw_pages_results”, ‘page’:0, ‘itemsperpage’:<?php echo $item_per_page; ?>, nonce: “<?php echo $tw_pages_nonce; ?>”}, success: function(response) { jQuery(“#results”).html(response); … Read more

jQuery is not defined, working on local server but not online

Add this in functions.php instead of header.php function frontEnd_scripts() { wp_enqueue_script(“jquery”); wp_deregister_script(‘jquery.mobile’); wp_register_script(‘jquery.mobile’, (“//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.js”),array(‘jquery’)); wp_enqueue_script(‘jquery.mobile’); wp_register_style(‘jqm_css’,(‘//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.css’)); wp_enqueue_style(‘jqm_css’); } add_action(‘wp_enqueue_scripts’, ‘frontEnd_scripts’);

How to prevent tabs from opening all at once

As you mentioned in the comment, inside-context paragraphs will be just next to clicked anchor’s parent, this code will work: $(“.btn-context”).on(‘click’, function (event) { event.preventDefault(); $(‘.inside-context’).removeClass(‘open’); $(this).parent().next(‘p.inside-context’).addClass(‘open’); });

Adding JS functionality to the Publish button in wp-admin/post.php

Solved it by using a modal box instead of metabox, forcing the users to finish editing the plugin data, before submitting the regular changes to WP. //add_action( ‘add_meta_boxes’, array( $this, ‘add_custom_metabox’ ) ); add_action( ‘media_buttons_context’, array($this, ‘add_custom_media_buttons’ ) ); add_action( ‘admin_footer’, array($this, ‘add_esm_edit’ ) ); These were the lines that were added to the __construct(). … Read more

how to use wp_editor() here am getting empty result

Your syntax for passing the settings array is incorrect and also you have not specified the name for the textarea in the settings array which is why it returns you an empty alert. Syntax from WordPress Codex: wp_editor( $content, $editor_id, $settings = array() ); $content (string) (required) – Initial content for the editor $editor_id (string) … Read more