Hi there,
This is a pretty basic thing about WordPress, but it’s not really obvious, so don’t feel bad that you don’t get it yet.
Are you making a theme from scratch, or starting from an existing theme? Are you making a child theme? I’m asking because there are several ways in which you can accomplish this, and some variation exists based on how you do it.
The Theme Developers’ Handbook has some documentation about Page Templates here:
https://developer.wordpress.org/themes/basics/page-templates/
What you want to do is create a page template that has a different header.php (so you can exclude the menus, but can include the other stuff that’s important, like CSS and Javascript), does not call any sidebars, and maybe calls a different footer. But you would do this in different ways depending on how you started out.
Hi!
Thank you for responding!
Yes, I have read that page on the developer site.Thank you for sending it though, unfortunately I still get lost. Something about it is not clicking.
I am making a theme from scratch. My employer wanted it to look exactly like his old site, and it seemed to be the easiest starting from scratch.
Hmm. If you’re making a theme from scratch, how are you getting the header, sidebar, etc into the pages in the first place? Are you starting from a totally blank set of code?
Well, I suppose it is not totally blank.
I started from a “theme” that was scraped down to the basics and I just added in my personal .css and navigation bar etc.
this is what it says on the header.php:
<?php
/**
* The Header for our theme.
*/
?><!DOCTYPE html>
<html>
<head>
<title><?php wp_title( ‘|’, true, ‘right’ ); ?></title>
<?php wp_head(); ?>
#title:
alight: right;
</head>
<body <?php body_class(); ?>>
This is what it says on the footer:
<?php
/**
* The template for displaying the footer.
*/
?>
<?php wp_footer(); ?>
</body>
</html>
This is what it says on the index.php
<?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.
* For example, it puts together the home page when no home.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*/
get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( ‘content’ ); ?>
<?php endwhile; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
anyway, you get the idea. I hope that helps.
Ah!
You can create different headers and footers by making files like:
header-blank.php
Then, you can put just the CSS you need, and none of the menu, in you header-blank.php file.
You can call it by doing:
get_header(‘blank’);
This works for the footer too.
To make the page template file, just save your index.php as something like special-page.php, add the appropriate comments (as highlighted on the link I sent you earlier) to make it a page template, and replace the calls to get_header and get_footer w/ the new files you want.
Also, just remove the “get_sidebar()’ call, and you won’t have a sidebar.
I hope this makes sense.