Support » Plugins » wp-cache -> keep sidebar dynamic?

  • I’ve tried to use the examples given by wp-cache & staticize to keep functions dynamic, but I am unsuccessful at making it work.
    (wp-cache uses the same dynamic wrapper)

    All I get is an error “unknown function” when I try to wrap the function call for getsidebar

    <!--mfunc get_sidebar() -->
    <?php get_sidebar() ?>

    Can anyone tell me what I am doing wrong?

    In case there is a question why, I have already made my sidebar semi-static and want to keep a few things like the user login name and online stats always functional.

    Thanks for any assistance/ideas!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mark Jaquith


    WordPress Lead Dev

    When you have a WP-Cache/Staticize Reloaded cached hit, WordPress is not loaded. You do not have access to any WordPress functions. That’s why the function is undefined. You can use PHP functions and any functions defined before WP load or within <!--mclude--> directives, but not WP functions. You’ll have to recode your sidebar to work without WordPress if you want it to be always dynamic.

    Ah I get it now – especially once I realize the whole point of the cache is not to load the thousands of lines of wp code and plugins.

    I guess what I need to do is find a variable that detects if wp-cache is turned on but experiencing a dynamic page call and cut out any custom bits like displaying the logged in user’s name.

    Actually it might be more complicated than that – without wordpress loaded how does it know who is about to comment on a post and display the entry form for logged in vs guest commenters? I guess it doesn’t?

    In the end, for now, I’ve just hacked wp-cache to handle only my feeds. Rather easy to do and since the feeds represent the 3rd most requested pages on the site, it has to help the load to some measurable effect. I’ll know soon enough!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp-cache -> keep sidebar dynamic?’ is closed to new replies.