Javascript,Nodejs,MongodDB,WordPress,CSS,PHP

LightBlog

Tuesday, October 30, 2018

How to create template for post type

Creating page templates for specific post types:
By default, a custom page template will be available to the “page” post type.
To create a page template to specific post types, add a line under the template name with the post types you would like the template to support.
just write header in your template page,this will appears in your post and post type which slug you define in your header of page,in this example this template will appears in your post,and post type event.
Example:

<?php
/*
Template Name: Full-width layout
Template Post Type: post, event
*/
// Page code here...

?>


This header is for page template if you want to make template for page write this header in your page,this will appears in your page template section
<?php
/*
Template Name: Full-width layout

*/
// Page code here...
?>

No comments:

Post a Comment