WordPress.org

Support

Support » How-To and Troubleshooting » Only show this HTML table on frontpage/index.php?

Only show this HTML table on frontpage/index.php?

  • 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>

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is in the Codex

    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?

    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; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Only show this HTML table on frontpage/index.php?’ is closed to new replies.