Support » Plugins » [Plugin: WP Super Cache] Half on & sidebars

  • When using mfunc to exclude sidebar from being cached like this:

    <!--mfunc get_sidebar('right') -->
    <?php get_sidebar('right'); ?>
    <!--/mfunc-->

    the sidebar stay dynamic but condition within widgets won’t work anymore, for example:

    function widget() {
       if(is_single()) {
         echo 'widget on single page';
       }
    }

    Nothing is printed on single…

    Is it known bug ? or I’m doing something wrong here ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • That’s a side effect of how the mfunc system works – WordPress hasn’t set up the is_single() settings when it serves the cache.

    You could try the late init configuration. See the developer docs.

    Tried that… not working also with late init… basically none of wp condition is working within a widget.

    I must say that’s a really sad side effect 🙁
    It’s like having a dynamic support along side serving from cache but
    without all the advantage of wordpress.

    Is there any way to work around it you think of ? maybe including some wp core files if serves from cache ?

    You could possibly examine the REQUEST_URI and manually figure out if you’re on a single page or not.

    I presume the single page check only works in “the loop” where posts are printed. The widget code is executed long before that when it’s cached.

    I can check if single.. the thing is, I’m not talking about checking only if single or not, I’m talking about every wp condition tags, for example, check if is category, can’t know that based on url (using permalink without ‘category’ prefix) unless I do some really crazy-non-logic db queries.

    Yeah, it’s a side effect of caching – you cache to reduce the load on your server and that means not doing as much processing and loading as much, but you have to sacrifice some functionality when a page is cached. (or do it another way, perhaps by loading the widget using Javascript)

    Thanks,I returned to ‘on’ mode 🙂 set it to 10 min caching, site is super fast, important widgets loads via js (banners etc..)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WP Super Cache] Half on & sidebars’ is closed to new replies.