@Ajay
thank you for this great plugin. After I updated this to latest vesion I am happy that it has lots of option. But like some ppl I am getting the ajax errors in some pages. I just chcked the code and got some solution.
// Function that adds wherego code to the post content
add_filter('the_content', 'ald_wherego_content');
function ald_wherego_content($content) {
global $post, $wpdb, $single, $wherego_url, $whergo_id;
$wherego_settings = wherego_read_options();
if (($wherego_settings['add_to_feed'])||($wherego_settings['add_to_content'])) $output_list = ald_wherego(); // Get the list
if(is_single() || is_page()) {
$whergo_id = intval($post->ID); // Make the $wherego_id global for detection in the footer.
}
add_filter('the_content', 'ald_wherego_content');
That hook is not done in all pages, like sometimes we use some custom pages using template like
<?php
/*
Template Name: Blog Template
*/
?>we can create an extra page using this tag and use custom query.
So in such pages the $whergo_id is null and should be null if thee is not the_content() call on that page.
Even in some plugins the is_single and is_page doesn't work for mess up with query_posts function. It changes the global $wp_query variable ... so in my functions.php file I use a function
function php4_clone($object) {
if (version_compare(phpversion(), '5.0') < 0) {
return $object;
} else {
return @clone($object);
}
} //end php4_cloneand use like this
$temp_query = php4_clone($wp_query); // saving ....
query_posts($query_post);
query_posts($query_post);
if(have_posts()) {
while(have_posts()) {
the_post();
......
///end while tag etc...
at last
$wp_query = php4_clone($temp_query); // here is retrive the global $wp_query varabove is the sample way.
to solve the ajax error issue I just changed one line in the plugin
near line 139
add_action('wp_footer','add_wherego_count');
function add_wherego_count() {
global $post, $wpdb, $single, $whergo_id;
if((is_single() || is_page()) && $whergo_id != NULL ) {
$id = $whergo_id;
?>
change is in this line
if((is_single() || is_page()) && $whergo_id != NULL ) {at least this will help not to call ajax or js if $whergo_id is null any how.
Let me