daveyheuser / WP-ajax-like-button

like button for Wordpress that can be used on posts, pages, custom post types, everywhere you have a metabox to store the likes in
21 stars 3 forks source link

Enqueue script instead of echoing in script tag #1

Open mmaumio opened 9 years ago

mmaumio commented 9 years ago

Hi, I'd like to thank you for your hard work and distributing it for free. It helped me put the like and dislike button in my Theme.

I was wondering If you'd Enqueue the admin-ajax.php file in the post-like.php on wp_enqueue_scripts hook and passing the url through wp_localize_script instead of echoing the hard coded script tag on the wp_head hook.

That'd be the best practice of the script.

Regards -Muntasir

daveyheuser commented 9 years ago

Hey that's actually a very good idea, I'm working on a website where I'll also implement this in and make an update when I get there.

Thanks for your kind words!