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.

<?php if(is_home() && !is_paged()) { ?> 



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

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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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