Sundance
Sundance

Reputation: 43

wordpress W3 Total Cache Fragmented Caching

I suppose to add this line to my functions.php

<!-- mfunc wpb_set_post_views($post_id); --><!-- /mfunc -->

but it produces error , tried to put <? but no luck. any idea why ?

when I open functions.php with dreamweaver to edit it and paste this code , it flag it with red and say syntax error , if I save it anyway then my site crash. Fragmented Caching is to prevent w3 total cache from caching something

here the complete function

function wpb_track_post_views ($post_id) {
    if ( !is_single() ) return;
    if ( empty ( $post_id) ) {
        global $post;
        $post_id = $post->ID;    
    }
   <!-- mfunc wpb_set_post_views($post_id); --><!-- /mfunc -->
}
add_action( 'wp_head', 'wpb_track_post_views');

Upvotes: 0

Views: 1643

Answers (1)

mbrinson
mbrinson

Reputation: 113

Your syntax is wrong. It should be like this:

<!-- mfunc --> wpb_set_post_views($post_id); <!-- /mfunc -->

Upvotes: 2

Related Questions