Title: stebcom's Replies | WordPress.org

---

# stebcom

  [  ](https://wordpress.org/support/users/stebcom/)

 *   [Profile](https://wordpress.org/support/users/stebcom/)
 *   [Topics Started](https://wordpress.org/support/users/stebcom/topics/)
 *   [Replies Created](https://wordpress.org/support/users/stebcom/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/stebcom/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/stebcom/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/stebcom/engagements/)
 *   [Favorites](https://wordpress.org/support/users/stebcom/favorites/)

 Search replies:

## Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fantastic ElasticSearch] Search won't display any results](https://wordpress.org/support/topic/search-wont-display-any-results/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/search-wont-display-any-results/#post-6021512)
 * Ok, I found that fuzzy search is triggered by appending “~” to the query string,
   hence the fuzziness amount parameters needs to be set at minimum value of 2.
   
   This is not a good approach because no common user will append ~ to his query
   string without anyone telling him to. I edited the code, adding ~ to every query
   string, so that fuzzy search is always triggered. I’ve just started exploring
   ElasticSearch and I don’t know it well, so this is probably not the best way 
   to arrange things, but at least it’s working.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fantastic ElasticSearch] Search won't display any results](https://wordpress.org/support/topic/search-wont-display-any-results/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/search-wont-display-any-results/#post-6021495)
 * I noticed the plugin uses ruflin/Elastica php client, so I downloaded the latest
   version of that library, then searches started giving results (I’m using version
   1.5.1 of ElasticSearch server, so I think server and php client versions simply
   didn’t match).
 * Not everything is ok though, because fuzzy searching is not working at all. Have
   you got any suggestion?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Fatal error trying using dynamic content](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/#post-5245060)
 * I worked on this a lot of time ago, so I don’t remember that much. I think I 
   gave up on Dynamic Cache Tag (the first option) because it didn’t work the way
   I needed, calling my functions ecc.
    Speaking about the output buffer: the code
   is still quite simple. You can define your constant where you prefer, like this:
 * `define( 'DYNAMIC_OUTPUT_BUFFER_TAG', 'Your placeholder' );`
 * The dynamic cache is not the only option to keep part of your pages dynamic, 
   anyway: if you have issues with that, you should try loading your content via
   ajax.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Fatal error trying using dynamic content](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/#post-5245056)
 * This is an example of usage for a woocommerce cart widget.
    I use this code in
   functions.php:
 *     ```
       if ( DYNAMIC_OUTPUT_BUFFER_TAG != '' ) {
   
         function dynamic_output_buffer_minicart( &$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
         	woocommerce_mini_cart();
   
         	$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 );
         }
   
         function dynamic_output_buffer_init() {
         	add_action( 'wp_footer', 'dynamic_output_buffer_minicart' );
           //add_action( 'wp_footer', 'dynamic_output_buffer_sidebar' );
         }
   
         function dynamic_output_buffer_test_safety( $safety ) {
         	if ( defined( 'DYNAMIC_OB_TEXT' ) ) // this is set when you call dynamic_output_buffer_test() from the theme
         		return 1; // ready to replace tag with dynamic content.
         	else
         		return 0; // tag cannot be replaced.
         }  
   
         add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_minicart' );
         add_cacheaction( 'add_cacheaction', 'dynamic_output_buffer_init' );
         add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety' );
   
       }
       ```
   
 * And this code in my template page:
 *     ```
       <?php
           if ( function_exists( 'dynamic_output_buffer_minicart' ) )
             dynamic_output_buffer_minicart();
           ?>Loading cart...
       ```
   
 * You should also enable late_init option in the WP Super Cache configuration.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Made Easy] Event title not being displayed](https://wordpress.org/support/topic/event-title-not-being-displayed/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/event-title-not-being-displayed/#post-5388463)
 * Yes, the_title() has to be called from inside the loop, you’re right. I edited
   the code to make the function to be called this way, but it doesn’t work:I still
   get ‘Events’ as title.
    The problem is that neither the wp_title() is working,
   so there must be something else I’m missing…
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Made Easy] Event title not being displayed](https://wordpress.org/support/topic/event-title-not-being-displayed/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/event-title-not-being-displayed/#post-5388443)
 * Hi Franky, thank you for your answer. It’s somehow more complicated: I tried 
   replacing the custom function of my theme with the standard “the_title()” call,
   but nothing changes. The only other difference between my custom theme and a 
   standard one is that the title block is written in the header.php file, instead
   of the page.php.
    Also, I cannot see the right title in the browser tab(<title
   > tag), even if it’s called the wp_title() function.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Trying to understand dynamic cacheaction filter…](https://wordpress.org/support/topic/trying-to-understand-dynamic-cacheaction-filter/)
 *  [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/trying-to-understand-dynamic-cacheaction-filter/page/2/#post-5176495)
 * Ok, that didn’t work because there was no call to dynamic_output_buffer_test 
   function in my template.
 * So, the correct code should be
 *     ```
       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
       	strtest();
       	$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 );
       }
       function dynamic_output_buffer_init() {
       	add_action( 'wp_footer', 'dynamic_output_buffer_test' );
       }
       function dynamic_output_buffer_test_safety( $safety ) {
       	if ( defined( 'DYNAMIC_OB_TEXT' ) ) // this is set when you call dynamic_output_buffer_test() from the theme
       		return 1; // ready to replace tag with dynamic content.
       	else
       		return 0; // tag cannot be replaced.
       }
       function strtest() {
         echo "hello";
       }
   
       add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test' );
       add_cacheaction( 'add_cacheaction', 'dynamic_output_buffer_init' );
       add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety' );
       ```
   
 * to use in functions.php, and
 *     ```
       if ( function_exists( 'dynamic_output_buffer_test' ) )
             strtest();
           ?>MY_BUFFER_TAG
       ```
   
 * to use in my theme page.
 * Now, what if I need more than one section to stay dynamic? I would need to use
   more than a buffer, but how?
    I adjusted the code, in order to output the different
   dynamic parts, when the function is called from my theme, but I get the same 
   result in all positions. For example, if I want a mini cart widget and another
   sidebar to stay dynamic, I get two mini carts, the first in its own place, and
   the second replacing the other sidebar.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Trying to understand dynamic cacheaction filter…](https://wordpress.org/support/topic/trying-to-understand-dynamic-cacheaction-filter/)
 *  [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/trying-to-understand-dynamic-cacheaction-filter/page/2/#post-5176493)
 * Ok,
 * I figured out how to make the dynamic cache work, using the simple replace method,
   but I can’t use the output buffer.
 * This is the code I put inside functions.php file of my theme
 *     ```
       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
       	strtest();
       	$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 );
       }
       function dynamic_output_buffer_init() {
       	add_action( 'wp_footer', 'dynamic_output_buffer_test' );
       }
       function dynamic_output_buffer_test_safety( $safety ) {
       	if ( defined( 'DYNAMIC_OB_TEXT' ) ) // this is set when you call dynamic_output_buffer_test() from the theme
       		return 1; // ready to replace tag with dynamic content.
       	else
       		return 0; // tag cannot be replaced.
       }
       function strtest() {
         echo "hello";
       }
       ```
   
 * And this is what I put in my template
 *     ```
       add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test' );
        add_cacheaction( 'add_cacheaction', 'dynamic_output_buffer_init' );
        add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety' );
           ?>MY_BUFFER_TAG
       ```
   
 * What am I doing wrong here?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Fatal error trying using dynamic content](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/#post-5244906)
 * Ok,
 * now I figured out how to make the dynamic cache work, but I have another problem
   now: I’m using the output buffer but it’s working only with Google Chrome, as
   the string replacement is not being performed with IE, nor Firefox. Unfortunately,
   I can’t spot any error and the cache logs the same lines after a page request
   made by Chrome and a page request made by Firefox or IE.
 * Any idea about this?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Fatal error trying using dynamic content](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-trying-using-dynamic-content/#post-5244677)
 * I forgot to replace
 * `add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety');`
 * with
 * `add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_cache_test_safety' );`
 * but I’m not able to get things working: I simply don’t see the code replacement.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Super Cache] Trying to understand dynamic cacheaction filter…](https://wordpress.org/support/topic/trying-to-understand-dynamic-cacheaction-filter/)
 *  [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/trying-to-understand-dynamic-cacheaction-filter/#post-5176491)
 * Hi,
    I’m trying to implement the dynamic cache too, but I’m quite lost by now.
   I got the dynamic-cache-test.php script, moved into a dynamic-cache-test folder
   under plugins folder and activated it as a new plugin. I defined DYNAMIC_CACHE_TEST_TAG,
   then I edited a page from my theme, switching this code:
 * `<?php woocommerce_mini_cart(); ?>`
 * with this:
 *     ```
       <!--mydynamicdata--><br />
           <?php woocommerce_mini_cart(); ?><br />
           <!--/mydynamicdata-->
       ```
   
 * I expected to see the Hello World text replacing the cart, but I just see the
   string
 * > –>
 *  before and after the cart widget content.
 * If I just put my secret string in a template page, that string is removed, but
   replaced with nothing.
 * Can you point me to the correct using of the dynamic cache functionality?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[TablePress - Tables in WordPress made easy] Retrieve table ID](https://wordpress.org/support/topic/retrieve-table-id/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/retrieve-table-id/#post-5042127)
 * Found it!
    Thanks a lot!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Magento Wordpress Integration] [Plugin: Magento WordPress Integration] Cannot display Magento blocks](https://wordpress.org/support/topic/plugin-magento-wordpress-integration-cannot-display-magento-blocks/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-magento-wordpress-integration-cannot-display-magento-blocks/#post-3027813)
 * No, my problem is that I’ve just approached WordPress and I still have to learn
   how it works. Browsing the code, I found out that content.php is my actual template(
   for main contents), while page.php lies on a higher level. I’ll keep exploring
   that, thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Magento Wordpress Integration] [Plugin: Magento WordPress Integration] Cannot display Magento blocks](https://wordpress.org/support/topic/plugin-magento-wordpress-integration-cannot-display-magento-blocks/)
 *  Thread Starter [stebcom](https://wordpress.org/support/users/stebcom/)
 * (@stebcom)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-magento-wordpress-integration-cannot-display-magento-blocks/#post-3027810)
 * Ok, I managed to display blocks from Magento inserting the code (for example 
   _the\_block(‘top.links’);_) in my content.php page. Still, I don’t have any custom
   php code working when I put it in page.php.
    Well, althought I have a bit of 
   experience with Magento, I’m totally new to WordPress, so I think my problems
   are WordPress related.
 * Thanks for the great job!

Viewing 14 replies - 1 through 14 (of 14 total)