• Walton

    (@walton)


    I’m working on a theme for teachers with a custom post type, lesson plan. For example: https://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 1 replies (of 1 total)
  • Thread Starter Walton

    (@walton)

    To be clear, the Materials meta boxes are not blank on the Edit Post page. And I did a brand new lesson plan to see if the issue was something with my cache. No luck.

Viewing 1 replies (of 1 total)
  • The topic ‘Some Custom Meta Boxes Not Showing’ is closed to new replies.