How to create page in Wordpress Theme?

User avatar
Mitch
Posts: 38
Joined: Mon Jan 30, 2017 4:58 am

How to create page in Wordpress Theme?

Mon Sep 03, 2018 2:43 am

Hi Guys,

As, requested here is the below separate page template for your wordpress theme.

Style.css
body.page-template-template-full-width-new-page #content #primary {
max-width: 100%;
}

body.page-template-template-full-width-new-page #content #primary .entry-header,
body.page-template-template-full-width-new-page #content #primary .entry-content {
float: none;
width: 100%;
}

body.page-template-template-full-width #content #primary .entry-header {
margin-bottom: 4em;
}
full-width-new-page.php
<?php
/**
* Template Name: Full Width New Page
*
* Description: A custom template for displaying a fullwidth layout with no sidebar.
*
* @package Twenty Seventeen Child
*/
get_header(); ?>

<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/page/content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>

</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .wrap -->

<?php get_footer();
How do I add this to the theme?

Below are two things you need to do:
1> Add template-full-width.php file at this location:
wp-content\themes\twentyseventeen\template-full-width.php
2> Append the code in style.css to this file:
wp-content\themes\twentyseventeen\style.css

To the admin side:
Image

On .css side:
Please note how i change the name to : body.page-template-template-full-width-new-page

The .page-template then i add the name of my new template template-full-width-new-page and the result is ( .page-template-template-full-width-new-page )


Return to “WEBSITE AND WEB DESIGN”

Links

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests
Registered users: No registered users
Most users ever online was 156 on Sun Jun 17, 2018 7:42 am
Total posts 449
Total topics 328
Total members 62
Our newest member anonymous-kali
No birthdays today