• Resolved Back to Front

    (@traverser11)


    I’m trying to think of an easy way to exclude the counter from my page cache…
    We’re using it for a petition counter on the home page, so I don’t want to exclude the whole page from the cache. The Siteground optimizer cache plugin we’re using has the easy option to exclude js files… So I tried putting the shortcode in a .js file, but then that .js file can’t execute the shortcode, of course…

    Any pointers in the right direction very appreciated.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter Back to Front

    (@traverser11)

    I guess i fixed this, the long way around?

    Please let me know if there’s a less roundabout way

    function progressCount(){?>
    <script>
      $progress = <?php echo (do_shortcode('[gravitywp_count formid="1" page_size="100000" thousands_sep=","]'));?>
     
     </script>
     <?php };
       
     
     add_action('wp_head', 'progressCount');
    jQuery(document).ready(function(){
    	// including in js file just so its easy to exclude from cache
    	
            jQuery('#petition-count').text($progress);
            
            }
      
            );
    • This reply was modified 4 years, 10 months ago by Back to Front.
Viewing 1 replies (of 1 total)
  • The topic ‘Exclude Count from cache’ is closed to new replies.