how can I make $ work in wordpress for jQuery?

Try this: jQuery(function ($) { /* You can safely use $ in this code block to reference jQuery Call your plugin here */ }) I think you already know this. But still for reference http://api.jquery.com/jQuery.noConflict/

Question about the way that wp_register_script works

For the record this entirely the wrong thing to do. Themes should avoid (read never!) de-register the WordPress registered jQuery scripts (plug-ins should absolutely never do this). If a theme is to de-register the jquery script (to replace it) then it should re-register it properly: wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js’); Here-in lies the problem. The above is … Read more

What are best practices for including jquery plugins

Why you shouldn’t hardcode javascript files There are several reasons why you shouldn’t hardcode links to javascript files: It sidesteps WordPress’ queuing of javascript files which is designed to handle dependencies for you. Plug-ins exist which force scripts to be loaded in the footer (hard-coding would mean they couldn’t do this, and may even break … Read more

wp_mail very slow

What am i doing wrong here? Many, many things, not all performance related. Lets begin with the critical parts, then conclude on your performance issues and what can be done to mitigate and help AJAX API Firstly, you’re not using the AJAX API, and reinventing the wheel. It’s quite simple: JS: $.post( do_mail_sending.ajaxurl, { action: … Read more

wp_ajax() question.. not using wp_enqueue_script?

Ok, firstly let me just break it down a little, so you understand the purpose of these functions. wp_enqueue_script() Description: A safe way of adding javascripts to a WordPress generated page. Basically, include the script if it hasn’t already been included, and load the one that WordPress ships. wp_localize_script() Description: Localizes a script, but only … Read more

Refine/Filter WP_Query Posts with jQuery or Ajax

I think what you might be looking for is combination of a plugin like https://wordpress.org/plugins/query-multiple-taxonomies/ and hooking into pre_get_posts if you are looping a list of posts. That plugin is in use on http://theboatworksnews.com/ so you can play with the projects section/filters and see if that matches what you’re looking for.

How do I setup nested repeatable option fields?

Not a direct answer to your specific case but this will probably help you figure out how to do it. I found an article here: http://www.sutanaryan.com/jquery-duplicate-fields-form-submit-with-php/ which details the process of posting fields which can be repeated using jQuery. In his example he creates an HTML form: <form action=”process.php” method=”post”> <p class=”clone”> <label> Name: </label> … Read more

adding google event tracking to links in posts

Have a look at this article -> http://www.optimum7.com/internet-marketing/web-development/dynamic-google-analytics-event-tracking-for-wordpress.html Also to get the post title of the particular page. You could use the following jQuery ( Assuming you post title is wrapped in tag ). outbound_post_name = jQuery(‘h1’).html();

jQuery Tree View and wp_list_pages

EDIT: After chatting with AlxVallejo, we came to a solution. Here’s what we talked about: You were not properly using the wp_enqueue_scripts hook and the functions that go along with it, as I informed you these hooks and actions need to be done in functions.php. You also discovered yourself that you were not initializing the … Read more

Handling jQuery Component Collision

My suggestion would be to use a mix of code isolation in an anonymous function and checking if jquery is already present. Here’s an example: (function() { var jQuery; // your jquery variable // check if jquery is present and if it has the version you want if (window.jQuery === undefined || window.jQuery.fn.jquery !== ‘1.8.3’) … Read more