Wordpress pagination, not show some content on numbered pages -


i'm working on news site in wordpress.

the news stories posts.

the home page has promotional section @ top , list of stories.

there pagination @ bottom show rest of stories on page.

on pages after home page don't want show promotional section.

the home page has url

    mysite.co.uk/news  

and second page like

    mysite.co.uk/news//page/2  

(i don't know why there 2 foward slashes after 'news')

i tried using if statment on is_page doesn't work.

    <?php           if(is_page('news')){     ?>          <div class="news-content-block">              <div class="container">                  <div class="news-content-block__header">                      <div class="row">                          <?php                               $news_intro = array(                                  'category_name' => 'news',                                 'post_type' => 'post',                                 'orderby' => 'date',                                 'order' => 'desc',                                 'posts_per_page' => 2                             );                              $news_loop = new wp_query($news_intro);                              if($news_loop->have_posts()) :                                 while($news_loop->have_posts()) :                                     $news_loop->the_post();                         ?>                          <div class="col-sm-6">                             <div class="news-article-block">                                 <a href="<?php the_permalink(); ?>">                                     <?php the_post_thumbnail('news_header', array( 'class' => 'img-responsive' ), true); ?>                                     <h4><?php the_title(); ?></h4>                                 </a>                             </div>                         </div>                          <?php endwhile; endif; ?>                          <?php wp_reset_postdata(); ?>                      </div><!--row-->                  </div>              </div><!--container-->          </div><!--content-block-->      <?php     }     ?> 

how show promotional things on news home page

put code in page template

if ( !isset($wp_query->query_vars['paged']) || $wp_query->query_vars['paged'] == 1 ) : # featured post code endif; 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -