Custom Field Array returning extra content – Why?
-
I’m not a PHP guy, but I pieced together this script. It works, but it returns extra content… in the for of the number “1”.
<?php $sidemodule_values = get_post_custom_values('sidemodule'); if ($sidemodule_values[0]=="") { include(TEMPLATEPATH . "/sidemodules/test3.php"); include(TEMPLATEPATH . "/sidemodules/test4.php"); } else { foreach ( $sidemodule_values as $key => $value ) echo include(TEMPLATEPATH . "/sidemodules/$value.php"); } ?>
I have two instances of the “sidemodule” custom field set up on a page with values of “test1″ and test2”. Here’s what I get back when the page is rendered:
<p>content (from test1.php)</p>1<p>content (from test2.php)</p>1
Everything works fine in terms of the content from the two external files is being displayed, but each block is followed by “1”.
I’ve tried several variations and I can’t figure out why. Any suggestions would be appreciated.
Basically I’m setting up a sidebar that will have default content that will be included unless custom fields have been applied to override it.
- The topic ‘Custom Field Array returning extra content – Why?’ is closed to new replies.