Grant Prudlow
Forum Replies Created
-
I found a problem with the plugin code itself, specifically the way it reads the template’s header, footer, and sidebar. Here’s the fix: https://gist.github.com/2721981. Just download it and replace the multiple_content.php file in /wp-content/plugins/multiple-content-blocks.
If you’re interested, here’s my explanation of the problem/fix:
I commented out some code between lines 161 and 172, where the code was attempting to parse the template for the parameter to
get_header()
(orget_footer()
, etc), and replaced it with what’s on line 174. If you go through the code, you’ll notice a problem with that if statement. For example, if your template has “… <?php get_header(); ?> …” (where … is the rest of the template), after line 155, $theTag will be “get_header(); ?> …”, then line 162 will drop the “get_header(“, leaving “); ?> …”. Then in the first line of the if statement (line 165),strpos($theTag,' )')
WON’T return 0, because it starts with “)”, not ” )”. The code will make an incorrect assumption about the format of your function call, $theTag ends up with all your template HTML, “.php” gets stuck on the end, and it tries to read it as a file. Whoops! I got rid of this format/annotation check and instead decided to get everything before the closing parenthesis (an empty string in the example above, “‘parameter'” if it’s something like “get_header(‘parameter’)”), and trim off any whitespace (to account for formatting preferences, such as “get_header( ‘parameter’ )”.Hope this helps.