Simple template (without header, sidebar and footer)

If it is necessary to use a page/post as simple as possible integrated in the site (especially if you want to embed it in other pages, you can use the following simple code:

<?php
/**
* Template Name: Page without Header / Footer / Sidebar
* Template Post Type: post, page, product
* Author: SOY
* Created on: 22/10/2020
*/
?>
 
<html <?php language_attributes(); ?> class="no-js">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
 
<div style="display: block; clear: both;"></div>
</head>
<body style="border:0px solid red;height:500px;overflow:hidden;">
<?php
while ( have_posts() ) : the_post();
the_content();
endwhile;
?>
<?php wp_footer(); ?>
</body>
</html>

If you want to keep the menu, you can insert, under the function wp_head(), the code corresponding to the menu display (as seen in the example appropriate to the theme):

<nav>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'primewp-menu-primary-navigation', 'menu_class' => 'primewp-primary-nav-menu primewp-menu-primary', 'fallback_cb' => 'primewp_fallback_menu', 'container' => '', ) ); ?>
</nav>

Author: Ovidiu.S

I am quite passionate about this professional area as if I know something - no matter how little - I want to share it with others.

Leave a Reply