Forums

How can I use foreach to display... (2 posts)

  1. Matt
    Member
    Posted 7 months ago #

    Hello guys,

    I was wondering how I can have a block of code display for each post that is in a certain category?

    <?php if ( in_category( _x('cat-name', 'cat-name category slug', 'ifcj') ) ) { ?>
           <div id="audio-player"></div>
    	   <script type="text/javascript">
              jwplayer("audio-player").setup({
                  flashplayer: "https://www.mySite.org/jwplayer/player.swf",
                  width:	440,
                  height:	23,
                  file: "<?php $key="Israel In The News Audio File Location"; echo get_post_meta($post->ID, $key, true); ?>",
                  controlbar: "bottom",
                  abouttext: "My Org",
                  aboutlink: "http://www.mySite.org",
                  allowscriptaccess: "always"
              });
           </script>
          <?php } ?>

    Currently this is only displaying for the first post in the loop with this category. I would like for it to display for each post with the category assigned to it.

    Any help would do

  2. vtxyzzy
    Member
    Posted 7 months ago #

    If you can show this code in context with the surrounding code, someone might be able to help.

    Put the entire file which includes this code in a pastebin and post a link to it here.

Reply

You must log in to post.

About this Topic