Enqueuing jQuery for WordPress Theme

Here is the function to add jQuery to the front end of the site.  You just need to enqueue the script labeled jquery. if (!is_admin()) add_action(“wp_enqueue_scripts”, “default_jquery_enqueue”, 11); function default_jquery_enqueue() {...

Fix Login Cookie Issue WordPress

//fix for cookie error while login. setcookie(TEST_COOKIE, ‘WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); if ( SITECOOKIEPATH != COOKIEPATH ) setcookie(TEST_COOKIE, ‘WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);...

Getting dynamic data into JavaScript using Ajax

So there are often times you would like to have settings in the WordPress dashboard but use the data in a js file. I found that this can easily be done using a jQuery.post call to a WordPress Ajax url. /* Javascript file */ var site_url = ”; jQuery( document...

Give View Entry access to a WordPress Role

So I came across this snippet of code recently when I was trying to find a way to give a user access to a form's entries based on a user role.  I did find that I needed to modify it a little bit for the menu side of things so that when you go to the view entries page...

Google Tracking Telephone Clicks w/ WordPress integration

So if you have jQuery and the gtag method for Google Analytics running on your site you can add the following code to the head tag of your site. jQuery( document ).ready( function() { jQuery(“a[href^='tel']”).on(“click”,function(){ gtag(...