• Resolved Chris

    (@dobeweb)


    I create a page template which will display the selected categories posts,
    I want to display a slider on the front page, nnce a user goes to the previous page (/page/2) the slider will no longer appear.

    I have read the post

    http://wordpress.org/support/topic/have-element-display-only-on-first-page-of-posts?replies=10

    But it don’t work on me.

    my code:

    <div class="entry-content clearfix">
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    		<the slider here>
    		<?php endwhile; endif; ?>
    		</div>
    
    <div id="content">
    <?php query_posts("showposts=8&paged="); ?>
    			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    [Please post code snippets between backticks or use the code button.]

Viewing 4 replies - 1 through 4 (of 4 total)
  • <div class="entry-content clearfix">
    <?php if ( is_home() && have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <the slider here>
    <?php endwhile; endif; wp_reset_query();?>
    </div>
    Thread Starter Chris

    (@dobeweb)

    Thank you for your quick response,
    but it also doesn’t work.

    <div class="entry-content clearfix">
    <?php if ( is_home() && have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; endif; wp_reset_query();?>
    </div>

    Thread Starter Chris

    (@dobeweb)

    I use

    <?php
    if (is_front_page() && !is_paged() )
    {?>
    
    <div>Flash Gordon</div>
    
    <?php } else { ?>
    
    <div>Wins the Battle!</div>
    <?php } ?>

    I don’t know why the result always: Wins the Battle!

    Thread Starter Chris

    (@dobeweb)

    Solved.

    I use this:

    <?php the_post(); ?>
    		<?php if ( $paged < 2 ) { ?>
    		<div class="entry-content clearfix">
    		<?php the_content(); ?>
    		</div>
    		<?php } else { ?>
    		<?php } ?>

    the content will display on the first page, and will not display on the other pages.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to dispaly the slider only on the front page’ is closed to new replies.