xpndpossible on "Creating a new template that hides header and footer"

ساخت وبلاگ

xpndpossible
Member
Posted 4 weeks ago #

I've already copied and renamed template.

I'm just looking for the proper way to hide the header and the footer.

In the forum I've found how to remove a header from a single page using:
https://wordpress.org/support/topic/how-to-remove-header-and-footer-from-a-single-page?replies=24

And I understand this is done in header and footer php...

'<?php if( !is_page( '1' ) ) : ?>'

and

'<?php endif; ?>'

However, I am trying to reference a template not a single page... So do I just replace "page" with "template" and '1' with the template name?

Thanks!

Our website

Hi xpndpossible. You could use CSS to hide the header and footer on the specified page. The page id is a class in the <body> tag. Use that and the id/class of the header and footer elements and set them to display:none. Something like this:

/* hide header and footer on one page */
.page-id-10 .header,
.page-id-10 .footer { display: none;
}

xpndpossible
Member
Posted 4 weeks ago #

Thanks for the quick response bdbrown!
The page I just tried it on is post=12625
https://main.possibletraining.com/schedule-complete-player/

So is this how it would read? I'm having a hard time locating the header id and footer id...

/* hide header and footer on one page */
.page-id-12625 .header,
.page-id-12625 .footer {
display: none;
}

Thanks again!

It looks like the footer class is .footer-dark (if that's the area at the bottom of the page you're trying to hide). What part of the "header" on that page are you trying to hide? Is it the same for all pages, or do other pages have different headers? And where exactly are you entering that CSS?

xpndpossible
Member
Posted 3 weeks ago #

I thought I replied via email last night but I don't see it in this thread...

Actually it would be great if I could just eliminate the top black bar in the header and the navigation, really...

And keep the logo on the left and the white part of the header intact.

All pages use the same header.

I entered the css in style.css in the theme editor in the appearance section. Do I need to do it in FTP?

Thanks!

xpndpossible
Member
Posted 3 weeks ago #

Quite honestly, I would keep the navigation if it is easy enough to change the menu labels and links... It wouldn't require the drop down menus.

I entered the css in style.css in the theme editor in the appearance section.

You're editing the default theme CSS file. Any changes you enter will be lost when you update the theme. You could use a child theme; then the Editor will load the child theme style.css file:
1. Download and activate the Childify Me plugin
2. Go to Appearance > Customize. There, you’ll see a new link added by the plugin.
3. Click on the button "Childify Me"
4. Name your child theme, click "Create"
5. Click "Preview and Activate"
6. Click "Save & Activate"
7. Go back to Appearance > Themes; your child theme should be active.

Or you could use a plugin like https://wordpress.org/plugins/simple-css/ or https://wordpress.org/plugins/simple-custom-css/.

You can use this CSS to remove the black bar in the header:

.header-bar-wrap { background-color: #fff;
}

xpndpossible
Member
Posted 3 weeks ago #

Thanks for your help bdbrown! I've created the child theme. And it's active. After all is done and I have made my edits, how will I use that child theme for my pages? Obviously I can change page templates for each page when editing a page... So am I essentially just targeting a specific template with CSS in the new child theme editor?

You use your child theme for basically 3 things:
1. Entering custom CSS in the style.css file. The child theme CSS is loaded after the parent theme so will most times override the parent CSS.
2. Entering custom functions in the functions.php file. The child functions are loaded before the parent theme functions. If the parent function doesn't check to see if the child has defined the same function (which most if not all of the Hueman functions do), the parent function wins.
3. Modifying theme template files by making a copy in your child theme and doing the modifications there. Your site then uses any template files it finds in your child theme and ignores the same file in the parent theme.

You can also do some other things like load custom JS or jQuery functions, but the above three are the most common uses. Is that what you're asking?

xpndpossible
Member
Posted 5 days ago #

Hello bdbrown,

I copied a template file into the new child theme.

I added the CSS to the style.css.

'.header-bar-wrap {
background-color: #fff;
}'

The theme is assigned and being used on the page however, the page is not responding to the CSS.

What am I missing?

If you have a child theme active, when you go to the Editor, you'll be editing the child theme style.css file, which is what you want. The CSS you posted above will tu the header bar white but I don't see it being applied. Where did you add it?

xpndpossible
Member
Posted 2 days ago #

The child theme is active and the css was posted in the style.css file. Except, the reason why you didn't see it is I was working from a different page. I updated the page https://main.possibletraining.com/schedule-complete-player/ with the template that is being used in the child theme, now.

Currently in "Page Attributes": Parent is "(no parent)" and template is "Page No Header".

The following is currently in style.css: (obviously without backticks)

/*
Theme Name: Michigan
Version: 1.0
Description: A child theme of I'm Possible by Codestud.io
Template: im-possible
Author: Micah Lancaster
*/
@import url("../im-possible/style.css");
/* Your awesome customization starts here */

'.header-bar-wrap {
background-color: #fff;
}'

And what I am trying to do is totally remove the black bar altogether, btw. And then utilize a different menu in the navigation for that template.

I can see that your page is using the custom template but I don't see any evidence of a child theme being active. Your parent theme is loading 20 different style sheet files but there isn't a style sheet file for your child theme and there aren't any custom styles being applied to the "header-bar-wrap" class. Does your wp-content/themes folder look like this?

/themes /im-possible /michigan page no header.php (or whatever the tmeplate is named) style.css

xpndpossible
Member
Posted 1 day ago #

Yes it does.

/themes
/im-possible
/michigan
functions.php
style.php
template-no-header-michigan.php

/themes
/im-possible
/michigan
functions.php
style.php
template-no-header-michigan.php

That should be style.css

xpndpossible
Member
Posted 34 seconds ago #

Sorry I just mistyped. It is style.css.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 268 تاريخ : جمعه 18 تير 1395 ساعت: 20:51