Show content only on front page?

I want to add some content (slider) only on the home page. I don’t want it to apear on the other pages. I am trying following:

<?php if(is_home()) { ?>
<div>
...
<div>
} ?>

But the content still appears on the second page (in pagination). How can i show some content to homepage only, so that id does not appear on second page? Thanks.

Related posts

Leave a Reply

4 comments

  1. The following lines should speak for themselve:

    global $paged;
    
    $max_page = (int) $wp_query->max_num_pages;
    if ( $max_page > (int) 1 )
        $paged = ! $wp_query->query_vars['paged'] ? (int) 1 : $wp_query->query_vars['paged'];
    
    // If not on the first page, not on the home or static front page and not if paged should (for some) reason be zero
    if ( (int) 1 !== $paged && (int) 0 !== $paged && ( ! is_home() || ! is_front_page() ) )
    {
        // display stuff
    }
    
  2. I always use home.php instead of index.php if I want a completely different home page than the other pages.

    I put this code in just before The Loop on home.php:
    <?php query_posts('cat=X&showposts='.get_option('posts_per_page')); ?>
    where cat=X is the category ID of a category I created and usually call Homepage or Frontpage.

    Then on the index page place this code:
    <?php query_posts($query_string . '&cat=-X'); ?>
    before the loop where &cat=-X is the same ID of your Homepage category. Notice the minus sign.

    Now just pick the Homepage or Frontpage category for the posts you want only on the home page.