Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Walton on "One set of custom meta fields not showing in post"

$
0
0

I'm working on a theme for teachers with a custom post type, lesson plan. For example: http://www.englishadvantage.info/testblog/lesson/writing-good-toefl-paragraphs-quickly/

The info on the right: Goals, Objectives, and Materials are all generated in meta fields I generated. I don't understand why the Goal is showing, the objectives are showing, but the materials aren't showing even though there is information there:

This is the code for that part of the page:

<div id="goal">
<?php if (!empty($goal)) echo "<h3>Goal</h3>","<br>",$goal; ?>

<?php if (!empty($objective1)) echo"<h3>Objectives</h3>","<br>","&#149", $objective1;?>
<?php if (!empty($objective2)) echo "<br>","&#149", $objective2; ?>
<?php if (!empty($objective3)) echo "<br>","&#149", $objective3; ?>

<h3>Materials</h3>
<?php if (!empty($materials1)) echo "<br>","&#149", $materials2; ?>
<?php if (!empty($materials2)) echo "<br>","&#149", $materials2; ?>
<?php if (!empty($materials3)) echo "<br>","&#149", $materials3; ?>
<?php if (!empty($materials4)) echo "<br>","&#149", $materials4; ?>
<?php $args = array(
   'post_type' => 'attachment',
   'numberposts' => -1,
   'post_status' => null,
   'post_parent' => $post->ID
  );
  $attachments = get_posts($args);
     if ($attachments) {
        foreach ($attachments as $attachment) {
           echo "<br>","&#149";
           the_attachment_link($attachment->ID, true);
     }
     };
?>
</div><!--#goal-->

You'll see one listing under Materials, but that is being picked up by the attachment loop at the end.


Viewing all articles
Browse latest Browse all 8245

Trending Articles