New "Feature" of sidebars being built by footer.php
Graphene is a great template overall. But its latest version(s) have introduced a structure I would consider somewhat strange. Giving me serious problems with other code.
I am current on 1.7, through a child theme. Heavily modified, among other to make it a “native” bbpress theme as well.
BUT.. I have been implementing object caching, which among other caches the template built header and footer HTML. This speed things up significantly, as menus and other stuff is not rebuilt on every page call.
As part of that, I suddenly had a problem, where the sidebar widgets would be in an incorrect state. For example, the bbpress login widget does not change status after logging in or out. The log-in/logout worked fine from what WordPress/bbpress think of the user-status, but the widget would show the wrong (old) status.
I of course then realized, that this was caused by the caching and the fact that graphene now suddenly builds the sidebar output in the footer code (footer.php). An oddity in my opinion.
Normally a general template structure would be something like:
build a content block
Footer and sidebars being separate objects.
But graphene now essentially call get_sidebar() inside any call to get_footer() and build the sidebar output as part of the footer build (code at the top of footer.php) instead of doing a separate get_sidebar() in the page/post template.
This means that when I cache what I would expect to be footer output, I actually end up caching the current state of the sidebar(s) as well.. This has the bad side-effect, that for example when logging out, the bbpress login widget in the sidebar does not reflect a correct status until the cached footer timeout and is rebuilt. (Including new sidebar code.) Quite annoying.
Would it be possible to restructure the code again, so sidebars and footers become separate objects, as WordPress normally expects them to be?
BTW.. This also had another side-effect when building the bbpress setup (with or without the caching functionality). The base bbpress template files call get_sidebar() and get_footer() separately, as most templates would do, which when added on top of graphene means two calls to get_sidebar(). One in the bbpress template code, and a second time inside its get_footer() call, when it hits graphene’s footer.php. I had to delete the bbpress calls to get_sidebar() to stop the doubling up on sidebar calls.
- You must be logged in to reply to this topic.