Hi Dot22!
One way of doing that could be by using the is_paged()
conditional. Depending on how your theme is structured you will have to make a few changes. The best, and recommended method would be to create a child theme and make changes that way.
Thread Starter
Dot22
(@dot22)
Hello Jose,
Thanks for your reply. This is the code of my index.php page:
<?php get_header(); ?>
<div class="content-path">Some text here</div>
<div class="container"><br />
<h2>News</h2>
<?php $c = 0; if ( have_posts() ) : ?>
<?php query_posts($query_string . '&cat=1'); ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); $c++; ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php if( $c == 2 ) :?>
<div style="margin: -50px auto 10px;"><hr /></div>
<?php $c = 0;
endif;?>
<?php endwhile; ?>
<?php custom_content_nav( 'nav-below' ); ?>
<?php else : ?>
<?php if ( current_user_can( 'edit_posts' ) ) :
// Show a different message to a logged-in user who can add posts.
?>
<div style="text-align: center; font-weight: bold;"><?php _e( 'Nothing found.', 'custom' ); ?></div>
<?php else :
// Show the default message to everyone else.
?>
<div style="text-align: center; font-weight: bold;"><?php _e( 'Nothing found.', 'custom' ); ?></div>
<div style="text-align: center; font-weight: bold;"><?php _e( 'Nothing found.', 'custom' ); ?><br />
<?php get_search_form(); ?>
</div><!-- .entry-content -->
<?php endif; // end current_user_can() check ?>
<?php endif; // end have_posts() check ?>
<div class="content-path2">More text here</div>
<div align="right"><a href="#top">up? <span class="fa fa-arrow-circle-o-up fa-lg"></span></a></div></div>
<?php get_footer(); ?>
How can I use the is_paged() conditional? Thanks again!
The most simplest way of using it is:
if ( !is_paged() ):
// code that will only show on the front page or
// page 1 or an archive
endif;
The codex page for it:
https://codex.wordpress.org/Function_Reference/is_paged