• Basically I am looking for how to get WordPress to recognize whether or not to have a certain label pertaining to a certain theme for individual posts on the index.php page. My problem is all “if” codes have not worked for me.

    I have a theme site that has HD, iPad and SD themes. I want to add a label for the HD and iPad themes and I’ve managed to get what I’m looking for through CSS. However, no matter what combination, I have not been able to get it to work properly. I call on the label to show up with <div class"hdtheme"></div> which will place the label at the top left corner. I want the HD label to show up for the HD themes, iPad label for iPad, and nothing for SD/everything else. They all followed the gist of:

    <?php
    if ( in_category( 'retina' )) {
    	<div class="hdthemes"></div>
    } ?>
    <?php elseif ( in_category( 'ipadthemes' )) { ?>
    	<div class="ipad"></div>
    <?php } else {
    	<div></div>(Sometimes I put like TESTING C to see if it working at all.
    }
    ?>

    On some, it won’t recognize, others, it will only recognize the else or the first if (So I’ll have all of them with the HD label, or all of the them TESTING C.
    The values in the categories (retina and ipad) are the slugs for the categories. I have tried the ID, and name that shows up.
    I have also tried

    <?php if(get_the_category( 'retina' )) { ?><div class="hdtheme"></div><?php } elseif(get_the_category( 'themesipad' )) { ?><div class="ipad"></div><?php } else { ?> <div></div> <?php } ?>

    or just

    <?php if(get_the_category( 'retina' )) { ?><div class="hdtheme"></div><?php } ?>

    Any suggestions?
    P.S.
    Someone said I should try it in the functions.php…how?
    https://winterboardthemegallery.iphather.com
    The starburst theme(first theme) is an iPad theme), and if you look, it has the HD even though it shouldn’t. Another check is the theme forms the nav, the SD themes (Themes320x480) have the HD too.

  • The topic ‘If Category on Index.php for lables.’ is closed to new replies.