• function dynamic_output_check_front( &$cachedata = 0 ) {
    	if ( defined( 'DYNAMIC_CHECK_FRONT_OB_TEXT' ) )
    		return str_replace( DYNAMIC_OUTPUT_CHECK_FRONT_BUFFER_TAG, DYNAMIC_CHECK_FRONT_OB_TEXT, $cachedata );
    
    	ob_start();
    	// call the sidebar function, do something dynamic
    	if( is_front_page() ) {
    		echo 'homepage: true';
    	} else {
    		echo 'homepage: false';
    	}
    	$text = ob_get_contents();
    	ob_end_clean();
    
    	if ( $cachedata === 0 ) // called directly from the theme so store the output
    		define( 'DYNAMIC_CHECK_FRONT_OB_TEXT', $text );
    	else // called via the wpsc_cachedata filter. We only get here in cached pages in wp-cache-phase1.php
    		return str_replace( DYNAMIC_OUTPUT_CHECK_FRONT_BUFFER_TAG, $text, $cachedata );
    
    }
    add_cacheaction( 'wpsc_cachedata', 'dynamic_output_check_front' );

    On first page load, will print “homepage: true”, but on every subsequent load, will print “homepage: false”. Why is this and is there a way around it?

    -Paul

    http://wordpress.org/plugins/wp-super-cache/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter PaulMighty

    (@paulmighty)

    Follow-up:
    Same holds true for is_page(‘home’) returning true on first load, then false on all subsequent loads.

    I am having a similar problem. I have a variable that checks if it is a certain page:

    if($is_front_page == 1){
        echo $ads['homepage_topbanner_mobile'];
    } else {
        echo $ads['article_topbanner_mobile'];
    }

    inside the standard dynamic content code.

    This works on the first load (I get the homepage ad) and then after that it defaults to the article ad.

    This plugin works a lot better for me than the Total Cache one, it’s been a lifesaver for our server load. But I do need a few of these things fixed eventually…. Your insight would help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Dynamic Cache: is_front_page() only works on first load’ is closed to new replies.