• I’d like to have an explanatory paragraph that appears only on the home page. I know I need to go to index.php and say that that page = home, and then in the header I use an if statement, if this is the home page then echo explanatory paragraph.

    I’m just not sure how to do that exactly. What the actual code would look like. I’ve made a few attempts, but I’m obviously in over my head.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter supak

    (@supak)

    I must be an idiot. While the page you referred me to was helpful, I keep getting an error saying it was expecting an “or”. Here’s what I have:

    <head profile=”http://gmpg.org/xfn/11″&gt;
    <title><?php bloginfo(‘name’) ?><?php if ( is_404() ) : ?> – <?php _e(‘Page not found’, ‘blogtxt’) ?><?php elseif ( is_home() ) : ?> – <?php bloginfo(‘description’) ?><?php elseif ( is_category() ) : ?> – <?php echo single_cat_title(); ?><?php elseif ( is_date() ) : ?> – <?php _e(‘Blog archives’, ‘blogtxt’) ?><?php elseif ( is_search() ) : ?> – <?php _e(‘Search results’, ‘blogtxt’) ?><?php else : ?> – <?php the_title() ?><?php endif ?></title>
    <meta http-equiv=”content-type” content=”<?php bloginfo(‘html_type’) ?>; charset=<?php bloginfo(‘charset’) ?>” />
    <meta name=”generator” content=”WordPress <?php bloginfo(‘version’) ?>” /><!– Please leave for stats –>
    <meta name=”description” content=”<?php bloginfo(‘description’) ?>” />
    <link rel=”alternate” type=”application/rss+xml” href=”<?php bloginfo(‘rss2_url’) ?>” title=”<?php bloginfo(‘name’) ?> RSS feed” />
    <link rel=”alternate” type=”application/rss+xml” href=”<?php bloginfo(‘comments_rss2_url’) ?>” title=”<?php bloginfo(‘name’) ?> comments RSS feed” />
    <link rel=”pingback” href=”<?php bloginfo(‘pingback_url’) ?>” />
    <link rel=”introspection” type=”application/atomserv+xml” href=”<?php echo get_settings(‘home’) ?>/wp-app.php” />
    <link rel=”stylesheet” type=”text/css” media=”screen” href=”<?php bloginfo(‘stylesheet_url’); ?>” title=”blog.txt” />
    <link rel=”stylesheet” type=”text/css” media=”print” href=”<?php bloginfo(‘template_directory’); ?>/print.css” />

    <?php wp_head() // Do not remove; helps plugins work ?>

    </head>

    <body class=”<?php blogtxt_body_class() ?>”>

    <div id=”wrapper”>
    <div id=”container”>
    <div id=”content”>

    <div id=”header”>
    <h1 id=”blog-title”>/” title=”<?php bloginfo(‘name’) ?>”><?php bloginfo(‘name’) ?></h1>
    <?php the_post() ?>
    <?php if ( is_day() ) : ?>
    <div class=”archive-description”><?php _e(‘You are currently viewing the daily archives for’, ‘blogtxt’) ?> <?php the_time(__(‘l, F Y’, ‘blogtxt’)) ?></div>
    <?php elseif ( is_month() ) : ?>
    <div class=”archive-description”><?php _e(‘You are currently viewing the monthly archives for’, ‘blogtxt’) ?> <?php the_time(__(‘F Y’, ‘blogtxt’)) ?></div>
    <?php elseif ( is_year() ) : ?>
    <div class=”archive-description”><?php _e(‘You are currently viewing the yearly archives for’, ‘blogtxt’) ?> <?php the_time(__(‘Y’, ‘blogtxt’)) ?></div>
    <?php elseif ( is_author() ) : ?>
    <div class=”archive-description”><?php _e(‘You are currently viewing the author archives of ‘, ‘blogtxt’) ?> <?php the_author(); ?></div>
    <?php elseif ( is_category() ) : ?>
    <div class=”archive-description”><?php if ( !(” == category_description()) ) : echo single_cat_title(); _e(‘ — ‘, ‘blogtxt’); echo category_description(); else : echo ‘You are currently viewing the category archives of ‘; echo single_cat_title(); endif; ?></div>
    <?php else : ?>
    <div id=”blog-description”><?php bloginfo(‘description’) ?></div>

    <?php
    if (is_home()) {
    echo “<div id=”blog-description2″>BLAH</div>”;
    }
    elseif () {
    echo “<p></p>”;
    } ?>

    Thread Starter supak

    (@supak)

    OK, that didn’t work either. Damnit. SOrry. What you see at the bottom, in the preformat font, is what I put in that didn’t work.

    Because you cut off the closing code for the previous if statements…

    And don’t post long code here – use pastebin service like http://wordpress.pastebin.ca

    Thread Starter supak

    (@supak)

    I didn’t mean to post long code. I was trying to post something I hope is very short.

    <?php
    if (is_home()) {
    echo "<div id="blog-description2">BLAH</div>";
    } ?>

    There I hope that works. Sorry, I’m a new poster here and didn’t get the open-close.

    Keep it in one single thread!
    Duplicate posts get deleted…

    Don’t use double quotes inside double quotes.
    Wrong: "<div id="blog-description2">BLAH</div>"
    Try "<div id='blog-description2'>BLAH</div>"

    Thread Starter supak

    (@supak)

    Ugh.

    I’m learning.

    Forest for trees.

    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘need to add paragraph in header that appears only on home page’ is closed to new replies.