• I wanted my headings to be h1 tags for the blog title if it was the home page, or the index page, with all other pages having just a link (and the h1 tag would be the page title). Rather than code a separate header template, I used these conditional tags in the header:

    <?php if (is_front_page()) { ?>
         <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
    
    <?php } else { ?>
          <a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a>
    
    <?php } ?>

    Appears to work like a charm, but since I am a PHP novice, only messing around with OPC (other people’s code) I wanted to be sure I got it right. Can you check my homework, Mommy? ??

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Conditional tags – did I do this right?’ is closed to new replies.