Support » Plugins and Hacks » how to use plugins hook (custom caching) in wp-supercache?

  • Hi, I would like to exclude some plugins from being cached, in particular wp-postviews (http://wordpress.org/extend/plugins/wp-postviews/) but have no idea how to do it.

    I’m using wp-postviews 1.02 and it has this function to count the views.

    ### Function: Calculate Post Views
    add_action('loop_start', 'process_postviews');
    function process_postviews() {
    	global $id;
    	$post_views = intval(post_custom('views'));
    	if(empty($_COOKIE[USER_COOKIE])) {
    		if(is_single() || is_page()) {
    			if($post_views > 0) {
    				update_post_meta($id, 'views', ($post_views+1));
    			} else {
    				add_post_meta($id, 'views', 1);
    			}
    		}
    	}
    }

    Could anyone give me some directive how to make it always count the post views even when caching is enabled? What should i put inside ‘wp-super-cache\plugins’ ?

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • zefefre – if you still want to use caching, and especially the static caching of the super cache plugin, then the pageviews plugin will have to be modified to use Javascript.

    If you just want to use the regular WP-Cache caching then use the “mclude” and “mfunc” tags.

    Thanks for your response donncha. 🙂

    I think for now I’ll just try using regular WP-Cache with mclude and mfunc as I have no idea how to modify the pageviews plugin to use Javascript.

    donncha: Do you have a rough guide or tutorial on how to use the js?

    GamerZ – I don’t have a guide or tutorial but look at the source code of my blog at http://ocaoimh.ie/ and search for the string “referer”. That bit of Javascript code creates a tiny 1×1 image out of my counter script.

    donncha: thanks dude =)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to use plugins hook (custom caching) in wp-supercache?’ is closed to new replies.