Forums

Only on the index page (8 posts)

  1. hbalagh
    Member
    Posted 6 years ago #

    I have stuff i want to show up on the index page of my blog (on the index template) i only want it to show up the first page but not on other pages further on. How do i get it to only show up on the main page?

  2. Beel
    Member
    Posted 6 years ago #

    Use the templates for all other pages, like the single page and archive page in the default theme, would be the easiest solution. Or use a conditional for is_home() if not.

  3. Jonathan Dingman
    Member
    Posted 6 years ago #

    Look around this page for all of your conditional needs:

    http://codex.wordpress.org/Conditional_Tags

  4. hbalagh
    Member
    Posted 6 years ago #

    I still don't understand all this stuff lol...ill have to play around alot

  5. Beel
    Member
    Posted 6 years ago #

    If you look in the default theme directory you should see "single.php" and "archive.php" - with those templates present they will display and not "index.php" when selecting a single post or archive (both off the front page).

    If you wanted to go the other route, the conditional would go in the index page with something like this:
    <?php if (is_home()) { ?>
    blah blah blah
    <?php } ?>

    I'd recommend reading the instructions in the codex.

  6. hbalagh
    Member
    Posted 6 years ago #

    thanks that worked :) im really new to php and all

  7. Beel
    Member
    Posted 6 years ago #

    Then the codex is the place you wanna be ... but no swimming pools or movie stars.

  8. Michael Bishop
    Forum Concierge
    Posted 6 years ago #

    Also note, that you can define a home.php template, that is ONLY loaded as the "home" page, then index.php becomes a catch-all, if the other templates are not loaded.

    template_hierarchy

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.