Using WP functions inside javascript

I found out about wp_localize_scripts here and it solves my issue: functions.php $var=get_current_user_id(); $params = array( ‘max’ => $var ); wp_localize_script( ‘myscript’, ‘MyScriptParams’, $params ); wp_enqueue_script(‘myscript’); and in the .js file I can retrieve this variable with MyScriptParams.max.

WP_ENQUEUE not working with Foundation 5

EDIT: I’m coming back to correct this post, having successfully wp_enqueue’d Foundation 5.3 for Sites to WordPress 3.9. This code below is for anyone who has struggled to WP_ENQUEUE Foundation. The code below works perfectly. UPDATES: I will continue to update this post with the newest version of WordPress and Foundation to give you all … Read more

Manipulate retrieved ajax data in php

Yes you should use die(); in ajax function call, but because you’re not returning data and don’t care what is returned it’s not necessary You should be using nonce, it’s good practice to get used to always using it regardless of the situation. http://codex.wordpress.org/WordPress_Nonces http://codex.wordpress.org/AJAX_in_Plugins You should not be using a function called func, name … 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 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

extra code in – blank jquery function

As per comments: this code is not doing anything. To find the culprit, first change your theme to a standard one to see if the theme is adding it. If yes, check header.php if it is hardcoded there or else functions.php for any instances of add_action(‘wp_head’…, where it might be lingering. If it’s not the … Read more

Does WordPress support Plupload chunking when uploading asynchronously?

To the best of my knowledge, no, the async-upload process on the WordPress side does not support chunking from plupload. You can find this code in /wp-admin/async-upload.php. To handle the uploaded file, it calls the wp_ajax_upload_attachment() function, in the ajax-actions.php file. This function refers directly to the PHP $_FILES array, meaning that the file would … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)