• I have a welcome message that I inputed on the index template that I only want to show on the home page. I tried inputting the code I saw on the sidebar:

    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    My welcome message
    <?php endif; ?>

    which didn’t work (https://www.sugar-buzz.net). I am pretty much PHP stupid.

Viewing 9 replies - 1 through 9 (of 9 total)
  • <?php /* If this is the frontpage */ if (is_home()) { ?>
    <p>My welcome message</p>
    <?php } ?>

    Try that.

    Thread Starter charlene2021

    (@charlene2021)

    That works as far as no error msg thanks but I am still able to see welcome message when navigating through entries.

    You mean when clicking on the prev/next posts link?
    Then probably you should add to that code something that tells “AND if not paged”

    I’m new to wordpress but not new to php. Had the same problem and fixed it like this

    <?php /* If this is the frontpage */ if ( is_home() && !is_paged() ) { ?>
    My welcome message
    <?php endif; ?>

    I get a parse error when I try this:

    “Parse error: syntax error, unexpected T_ENDIF in /home/tgamble/public_html/wp-content/themes/Lonely_Lemon/index.php on line 17”

    Here is the page code and the -strong- part is the text I want to show only on the home page. Thanks in advance for any help.

    <?php
    get_header();
    ?>
    
    <table border="0">
    <tr valign="top" align="left"><td>
    <?php get_footer(); ?></td><td>
    
    <div class="post_post">
    
    <strong>Keep track of the latest changes in the poker world<ul></ul>
    
    <FONT SIZE=1>
    Keep yourself updated on the <a href=" https://www.pokerlistings.com/online-poker-rooms"> online poker world </a>.  Who are the best players, where are <a href="https://www.pokerlistings.com/pokerroom "> all the best pokerrooms </a> for online play? Answers to this questions can be found at a site called <a href="https://www.pokerlistings.com/"> www.pokerlistings.com</a>, they have all the news.  Check them out!
    </FONT SIZE></strong>
    </br>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <div class="post" id="post-<?php the_ID(); ?>">
    <h3 class="storytitle"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/topicup.gif" alt="rispost"> <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    <h2><?php the_time('F jS, Y') ?></h2>
    
    <!--	<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_author() ?> @ <?php the_time() ?></div> -->
    
    	<div class="storycontent">
    		<?php the_content(__('(more...)')); ?>
    	</div>
    
    <div class="feedback">
                <?php wp_link_pages(); ?>
                <?php comments_popup_link(('Read Comments (0)'),('Read Comments (1)'),('Read Comments (%)'),'read_post'); ?><?php edit_post_link('Post your own','<span class="edit_post_link">','</span>&nbsp;') ?>
    
    </div>
    </div>
    
    <?php comments_template(); // Get wp-comments.php template ?>
    
    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    
    <?php endif; ?>
    </div>
    <?php posts_nav_link(' — ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
    
    </td></tr></table>
    
    </td></tr><tr><td>
    <div class="bottombar2">
    This Gambling News Blog is powered by <a href="https://www.remarpro.com">WordPress</a>, <a href="https://www.templatemonster.com">Design by Template Monster</a>
    <a href="/?feed=rss2">Entries</a> (RSS) and <a href="/?feed=comments-rss2">Comments</a> (RSS)
    </div>
    <td><tr></table>
    
    </body>
    </html>

    jayg123: You need to validate and fix your code (you have lots of serious code errors like unclosed tags and div tags where they don’t belong).

    The link you gave me was for another site, my site is https://www.topgamblingnews.com, I was suprised to see 80 on their site but when I keyed in my URL it came up with 86!!!

    Anyone able to help with the code to showing this text on the home page only?

    Keep track of the latest changes in the poker world<ul></ul>
    
    <FONT SIZE=1>
    Keep yourself updated on the <a href=" https://www.pokerlistings.com/online-poker-rooms"> online poker world </a>.  Who are the best players, where are <a href="https://www.pokerlistings.com/pokerroom "> all the best pokerrooms </a> for online play? Answers to this questions can be found at a site called <a href="https://www.pokerlistings.com/"> www.pokerlistings.com</a>, they have all the news.  Check them out!
    </FONT SIZE>

    I am not sure on the rules for bumping on this forum, so please delete this if I am not allowed.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Show Something Only On Home Page’ is closed to new replies.