wordpress - Want My page.php file to display different pages categories Loops -


in page.php file, i'm aiming have different categories' loops different pages using conditioner:

if (is_page(array('pagename1', 'pagename2'))) { } 

but when placed loop below inside 'is_page' braces, got blank page

<?php     $newsposts = get_posts('cat=4');      foreach($newsposts $post) :         setup_postdata($post); ?> <a href="<?php the_permalink(); ?>">     <div class="col-lg-3 col-md-4 col-sm-6">         <div class="newsbox2 newsboxcolor1">             <div class="newsbox3pix boxeq">                 <?php                     if ( has_post_thumbnail() ) {                         the_post_thumbnail( 'full', array() );                     }else {                   ?>                      <img src="<?php echo get_bloginfo('template_directory');?>/images/noimage.jpg" alt="no image">                 <?php } ?>             </div>             <div class="newstitle boxeq2">                 <span class="matchtime"><?php the_time();?><br></span>                 <h3><?php the_title(); ?></h3>             </div>             <span class="fa fa-comments cmnt"> <?php comments_number('0','1','%'); ?></span>      </div><!--newsbox2-->   </div>         </a> <?php endforeach; ?> 

how go integrating these can have pages conditionals inside 1 file? appreciate suggestion here. cheers

categories not used pages used posts.

the code get_posts('cat=4') fetch posts under category.

if write code in page.php in pages created backe-end , posts of specified category.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -