@bestrer

Динамический блок в WP Super Cache?

При использовании плагина WP Super Cache 1.4.9 кешируется динамический блок.
Пробовал так
в dynamic-cache-test.php
function dynamic_output_buffer_test( &$cachedata = 0 ) {
    if ( defined( 'DYNAMIC_OB_TEXT' ) )
        return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG, DYNAMIC_OB_TEXT, $cachedata );
    ob_start();
    // call the sidebar function, do something dynamic
    echo "<p>This is a test. The current time on the server is: " . date( 'H:i:s' ) . "</p>";
    $text = ob_get_contents();
    ob_end_clean();
 
    if ( $cachedata === 0 ) // called directly from the theme so store the output
        define( 'DYNAMIC_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_BUFFER_TAG, $text, $cachedata );
 
}
add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test' );


В single.php
if ( function_exists( 'dynamic_output_buffer_test' ) )
    dynamic_output_buffer_test();
?>WORDPRESS ROCKS THE WORLD<?php


При включенном кешировании "WORDPRESS ROCKS THE WORLD" не выводится.
  • Вопрос задан
  • 530 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы