How to include jquery validate in a template

Yes. You’re right. It’s because of the jQuery noConflict mode. You need to use jQuery instead of $. Or you can wrap everything in a function like this to define it’s scope (function($){ $(“#generateForm”).validate({ submitHandler: function(form) { $(form).ajaxSubmit(); }, rules: { … } }, messages: { … } } }); })(jQuery); Based on several posts, … Read more

AJAX post into pop-up div

Your code is not clear as it is out of context but it looks to me like you are loading your posts pages over AJAX through their normal URLs– URLs like http://example.com/this-is-a-post/ or http://example.com/2012/12/01/this-is-a-post/. The drawback to doing that you are loading the entire WordPress and theme framework into your popup, which may be much … Read more

Jquery ajax to custom php file: returning blank data

You are going on the wrong way.This will create difficulties and is NOT WORDPRESS STANDARD.Wordpress has a ajax technique to implement this. Call the ajax from your page <script> var data = { ‘action’: ‘insert_data_customtable’, ‘first_name’: firstname, ‘last_name’: lastname }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php … Read more

ajax call in wordpress front end

You have to localize script by using wp_localize_script function. In the admin side ajaxurl is already available. But in front end you have to localize script to define ajaxurl. Example: wp_enqueue_script( ‘custom-ajax-request’, ‘/path/to/settings.js’, array( ‘jquery’ ) ); wp_localize_script( ‘custom-ajax-request’, ‘MyAjax’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) ) );

How to include jQuery properly?

assuming you have enqueued everything ( script files and style files ) properly in your wordpress theme’s folder following would be ( just assume ) your theme files wp-content/themes/your-theme-dir/ assets/ css/ ( this is directory/folder ) styles.css ( this is file ) js/ scripts.js index.php functions.php lets say your code shown above is in index.php … Read more

Twitter Bootstrap Use Collapse in Custom Post Type

The script First you have to enqueue the script. We conditionally load it only for your custom post type and its archive(s). // in your functions.php function wpse69274_enqueue_tbs_collapse() { if ( ! is_post_type_archive() AND ‘YOUR_POST_TYPE’ !== get_post_type() ) return; wp_enqueue_script( ‘tbs-collapse’ ,get_stylesheet_directory_url().’path/to/your/collapse.js’; ,array( ‘jquery’ ) ,filemtime( get_stylesheet_directory().’path/to/your/collapse.js’ ) ,true ); } add_action( ‘wp_enqueue_scripts’, ‘wpse69274_enqueue_tbs_collapse’ ); … Read more

Querystring data gets truncated

As you have asked wether or not you have done the url encoding for the ampersands right, then my answer is: No. You are calling a javascript function, you’re not outputting something as x(ht)ml. You therefore do not need to encode & as &amp;. The function is expecting a URL not a string that contains … Read more