PHP help required!
-
Hi there
I’m trying to use different class elements for each category. What I’ve got below works for posts categorized “music”, which have the category ID of 5. But I can’t figure out how to get additional ID’s to use other classes.
You’ll see below in bold where I tried to add another class. If I remove this part, it works fine.
Any ideas please?
Here’s the code…
<h3 class=”accordion_toggle”>
<?php foreach((get_the_category()) as $cat) $id = $cat->cat_ID; ?>
<?php if ($id == 5) { ?>
<div class=”music”>
<?php if ($id == 3) { ?>
<div class=”print”>
<?php } else { ?><div class=”accordion_toggle”><?php } ?>
<span class=”float-left”><?php the_title(); ?></span><span class=”float-right”><?php the_time(‘F jS, Y’) ?> </span>
</h3>
- The topic ‘PHP help required!’ is closed to new replies.