Categories and page filtering with pre_get_posts
Please Consider this snippets of code. <?php $myarticles = new WP_Query( ‘post_type=myarticles&orderby=date&order=DESC&cat=4’ ); while ($myarticles->have_posts()) : $myarticles->the_post(); $postTitle = get_the_title(); $postid = get_the_id(); $postContent = get_the_content(); ?> <li><p><?php echo $postTitle; ?></p> <a href=”#”><?php the_post_thumbnail(array(219,143)); ?></a> <p><?php echo $postContent; ?></p> </li> <?php endwhile; ?>