Multiple Notifications SetInterval

There’s two approaches you may want to use here, depending on the notification behavior desired: To notify each user any time there are new notifications: You need to make sure your sql query returns the notifications in a sorted order (preferably with descending data timestamps) and includes a unique identifier/primary ID [PID] for the rows … Read more

Proper way of minifiying java script files in wordpress theme

Ad1. Just after make minification, do some tests with development tools (F12 in FF) There is a console where you will see all errors, warning etc. If something went wrong, you’ll see it https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console Ad2. Hard to say because every case is different but sometimes it’s matter. Which plugin do you use for that? For … Read more

Pass product object to javscript

Just change wp_localize_script( ‘load_product_info’ , ‘products’ , $gg_products); with (EDITED ->wp_localize_script() accepts an array as 3rd par.) wp_localize_script( ‘load_product_info’ , ‘products’ , array(‘current_products’=>json_encode($gg_products ) ) ); transforming the php object into a json string and building an array . Then in the js file convert the string into a js object with JSON.parse function load_product_info() … Read more

Help wiht adding fullcalendar.io to a WordPress page

Figured it out! First I passed what Iceable suggested and also added moment script above, like so wp_register_script(‘moment’, “https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js”); wp_register_script( ‘fullcalendar’, “https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js”, array( ‘jquery’ ), null, true); and then I edited JS like so jQuery(function ($) { $(‘#calendar’).fullCalendar({ }) }); And it showed up!

ajax polling with admin-ajax.php

You idea is equivalent to DDOSing your site, and the difference between the methods is only how fast you will bring the site down. WordPress AJAX handling is expensive, and should be limited to user initiated actions. Your second method will be more resilient but you are still going to be wasting server resources as … Read more