WordPress.org

Ready to get started?Download WordPress

Forums

Only show this HTML table on frontpage/index.php? (4 posts)

  1. Ezcali
    Member
    Posted 6 years ago #

    Hi,

    I've run into some problems with my WordPress theme.

    I have some HTML code on my index.php file which I only want to display when the user is on the frontpage.

    The problem is the HTML/table below is being copied-in on all my WordPress article/comment pages. Can i make some kind of custom loop so the code below is only displayed on the frontpage where all the latest news are shown - and not inside my articles as well?

    HTML code:

    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td><h3>ET INTERESSENTSELSKAB FOR SKOV & JAGT</h3></td>
    </tr>
    <tr>
    <td><h1>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></h1></td>
    </tr>
    <tr>
    <td class="intro_text"><?php bloginfo('description'); ?></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>

  2. mojorob
    Member
    Posted 6 years ago #

    This is in the Codex

  3. Ezcali
    Member
    Posted 6 years ago #

    mojorob: Thanks for your reply. Yeah i read that page but i cannot figure out how to code it so the table i mention only displays on the frontpage. Can you give me some kind og code-solution on how to fix it?

  4. Ezcali
    Member
    Posted 6 years ago #

    I have tried the code below but it just wont work. The text 'Article page' is being shown on both the Frontpage and Article pages:

    <?php if (is_front_page()):?>
    <table>
    <tr>
    <td>Frontpage</td>
    </tr>
    </table>
    <?php else : ?>
    <table>
    <tr>
    <td>Article page</td>
    </tr>
    </table>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.