Combining media queries with image sizes

First off, kudos to this pretty cool solution. I think you’re on the right track and not sure how much more you could do. You could certainly replicate the above with PHP & CSS, thus not requiring jQuery. It would require you to have an array of your sizes and just loop through them. This … Read more

Not sure why wp_ajax isn’t working?

This is just a simple javascript issue. When your javascript that attaches the click behavior to the form is parsed, the form element doesn’t yet exist because it’s further down the page, so it doesn’t get attached. Either move the javascript below the form, wrap it in a jQuery(document).ready(), or use live. EDIT – $(‘#ajaxForms’).serialize(); … Read more

Script for initializing JQuery Masonry for WordPress

This executes, when the DOM has been constructed, before all content has been loaded $(document).ready(function(){ … }); $(function(){…}); // short form This executes, when all content has been loaded $(window).load(function(){ … }); This executes immediately, when it is first encountered by the browser (function(){ … })(); The latter is known as a self-executing anonymous function, … Read more

How can I check email exists via a jquery keyup()?

I would use an AJAX request to a PHP script that does the lookup, which might look something like this on the jQuery side after document ready: // jquery $(‘#email-input’).live(‘change’, function() { //ajax request $.ajax({ url: “email_check.php”, data: { ’email’ : $(‘#email-input’).val() }, dataType: ‘json’, success: function(data) { if(data.result) { alert(‘Email exists!’); } else { … Read more

How to get a value from PHP in Jquery through Ajax

You are passing ‘readen_color’ as the action parameter, but you’ve defined the ajax action as ‘mark_as_read’. Try this: $.post(ajaxurl, { action:’mark_as_read’, post_id: iPostId }, function (response) { console.log(response); }); And as for your PHP: add_action( ‘wp_ajax_mark_as_read’, array( &$this, ‘readen_color’ ) ); // Add no_priv if you want users not logged in to be able to … Read more

Enqueue Google CDN jQuery in Footer

The right hook The wp_default_scripts-hook only runs in the admin as it’s called by wp_default_scripts() on ~/wp-admin/load-scripts.php where it’s hooked at the end of the file. So to move jQuery in public to the footer, you have to use a different hook: wp_enqueue_scripts, which only runs in the public. No admin check needed. <?php defined( … Read more