1/* make this file in template-parts folder
2 give file name as category_post.php */
3
4<?php
5/**
6 * Template Name: Category Custom Page
7 */
8
9get_header(); ?>
10
11<div id="primary" class="content-area">
12 <main id="main" class="site-main" role="main">
13
14 <?php
15 $args = array(
16 'post_type' => 'post',
17 'post_status' => 'publish',
18 'category_name' => 'wordpress',
19 'posts_per_page' => 5,
20 );
21 $arr_posts = new WP_Query( $args );
22
23 if ( $arr_posts->have_posts() ) :
24
25 while ( $arr_posts->have_posts() ) :
26 $arr_posts->the_post();
27 ?>
28 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
29 <?php
30 if ( has_post_thumbnail() ) :
31 the_post_thumbnail();
32 endif;
33 ?>
34 <header class="entry-header">
35 <h1 class="entry-title"><?php the_title(); ?></h1>
36 </header>
37 <div class="entry-content">
38 <?php the_excerpt(); ?>
39 <a href="<?php the_permalink(); ?>">Read More</a>
40 </div>
41 </article>
42 <?php
43 endwhile;
44 wp_pagenavi(
45 array(
46 'query' => $arr_posts,
47 )
48 );
49 endif;
50 ?>
51
52 </main><!-- .site-main -->
53</div><!-- .content-area -->
54
55<?php get_footer(); ?>
1/*on top of Php file add the below line to make as custom template*/
2
3<?php /* Template Name: Custom template name */ ?>
1<?php
2/**
3* Template Name: Full Width Page
4*
5* @package WordPress
6* @subpackage Twenty_Fourteen
7* @since Twenty Fourteen 1.0
8*/