Stuck making custom template (for 2020 theme)
-
Hi I am trying to make a blank custom template so I can make a diffrent design for a particular page type. My theme is 2020, but for some pages I want a very slimmed down theme with just a plain background, no menu etc.
What I have done so far:
– made a text file called vignette-template.php
– saved it in 2020 child (there are only two other files there, functions.php and style.css)
– put in the php I found on a forum (https://www.cryoutcreations.eu/forums/t/blank-page-template) and edited the info. The code is now:<?php /** * The main template file * * This is the most generic template file in a WordPress theme * and one of the two required files for a theme (the other being style.css). * It is used to display a page when nothing more specific matches a query. * E.g., it puts together the home page when no home.php file exists. * * @link https://developer.www.ads-software.com/themes/basics/template-hierarchy/ * * @package WordPress * @subpackage Twenty_Twenty * @since Twenty Twenty 1.0 */ <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; ?> <?php endif; ?>
Problem:
It’s not appearing in the page attributes > templates section as expected though – not sure if thats bad php or something else.
I looked at “WordPress template hierarchy” but didn’t really understand how to act on the info there.
I’m very new at this level of development work and my understanding of php and things isn’t great. but I’m keen to learn! I
- The topic ‘Stuck making custom template (for 2020 theme)’ is closed to new replies.