WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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()) { ?>
} ?>

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.

share|improve this question
<?php if(is_home() && !is_paged()) { ?> 


share|improve this answer

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
share|improve this answer

Have you tried <?php if(is_front_page()) { ?> I believe this is for using with sites that use a static home page.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.