WordPress.org

Ready to get started?Download WordPress

Forums

Conditional tags - did I do this right? (2 posts)

  1. RoseCitySister
    Member
    Posted 6 years ago #

    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? :)

  2. RoseCitySister
    Member
    Posted 6 years ago #

    Well, I guess no news is good news. It can't be my breath, can it? :(

Topic Closed

This topic has been closed to new replies.

About this Topic