Print javascript in wp_footer
-
Hi Hector,
first of all, thank you a lot for your plugin, it has been a great help. I am using it on a custom themed page and run a custom database query to fetch the data I need.
I updated today from 2.3.7 to 3.1.1, adapted my custom stuff to your new table structure and all worked well. However, I realized that no new pageviews were added. I investigated and saw that WPP prints its javascript (which relies on jQuery) in the head, while I load all my scrips in the footer. Therefore it threw an error and didn’t work.
In order to fix it I went into you code and edited line 355 of wordpress-popular-posts.php from this:
add_action( 'wp_head', array(&$this, 'print_ajax') );
to this:
add_action( 'wp_footer', array(&$this, 'print_ajax'), 100 );
(the 100 is for making it print after all the other javascript is loaded)I thought you might want to change that for you next update. As far as I can see it won’t hurt and your ajax call is done after the page is loaded anyway.
Blessings,
Lukas
- The topic ‘Print javascript in wp_footer’ is closed to new replies.