Display an include from a Custom Field Value
-
Hello,
Following on from my previous post here I need some more help.
I would like to use the following code to show certain guides if a checkbox is selected. When this script runs with only one guide selected it displays 3 times. I realise this was originally for words like ‘John, Mary, James’ so I would be grateful if someone could let me know what bits I need to change. Thanks Jono
<?php $gt_guides=get_post_meta($post->ID, "gt_guides", false); $out=''; $between =', '; if ($gt_guides) { foreach($gt_guides as $guide) { if ('Phil' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-phil.php'); } elseif ('Rob' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-rob.php'); } elseif ('Nic' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-nic.php'); } elseif ('Jef' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-jef.php'); } elseif ('Ben' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-ben.php'); } elseif ('Brend' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-brend.php'); } elseif ('Crys' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-crys.php'); } elseif ('Kev' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-kev.php'); } elseif ('Peter' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-peter.php'); } elseif ('Shane' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-shane.php'); } elseif ('Dan' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-dan.php'); } elseif ('Lynne' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-lynn.php'); } elseif ('Alex' == $guide ) { include(TEMPLATEPATH . '/includes/guides/guides-alex.php'); } else {$out .= $guide . $between;} } echo substr($out,0,-2);} ?> <?php } ?>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Display an include from a Custom Field Value’ is closed to new replies.