custom image on different category posts on home page
-
On my home page using my index.php file I display a custom image & link on each post. I want to be able to display a different image for posts from a specific category using in_category. What I have returns the first image but not the second, the other posts display no image. Why is my “else” not working?
<p><?php the_content('') ?></p> </div> <div class="xReadMore"> <?php if (in_category( '327' )): ?> <a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_url'); ?>/images/readMore-VIDEO.png" alt="" /></a> <?php else : ?> <a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_url'); ?>/images/ readMoreContent.jpg " alt="" /></a> <?php endif; ?> </div>
`
[Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘custom image on different category posts on home page’ is closed to new replies.