php - Page template not working when logged out

I created a page template that removes the navigation and footer coder (while still keeping the call to the style sheet

I created a page template that removes the navigation and footer coder (while still keeping the call to the style sheet and any javascript) and it works when I am logged into wordpress, but when I log out of wordpress it doesn't seem to function. Here are some screenshots:

Logged in (what I want the page to look like at all times):

Logged out (not correct, the page should not have the navigation or footer):

The way I generated this template was by starting with a page template I currently have, adding in the header and footer code (instead of calling to it) and deleting the navigation content and the footer content from the code.

Is there something I may have removed in the code that specifies what template to use if a wordpress user is logged in/out?

Here is the code I removed from the header:

Code removed from header

Here is the code I removed from the footer:

Code removed from footer

I am using a built child them of the Wizard Theme

I created a page template that removes the navigation and footer coder (while still keeping the call to the style sheet and any javascript) and it works when I am logged into wordpress, but when I log out of wordpress it doesn't seem to function. Here are some screenshots:

Logged in (what I want the page to look like at all times):

Logged out (not correct, the page should not have the navigation or footer):

The way I generated this template was by starting with a page template I currently have, adding in the header and footer code (instead of calling to it) and deleting the navigation content and the footer content from the code.

Is there something I may have removed in the code that specifies what template to use if a wordpress user is logged in/out?

Here is the code I removed from the header:

Code removed from header

Here is the code I removed from the footer:

Code removed from footer

I am using a built child them of the Wizard Theme

Share Improve this question edited Aug 7, 2019 at 0:08 Kasandra Murray asked Aug 6, 2019 at 18:54 Kasandra MurrayKasandra Murray 11 bronze badge 5
  • Hi, Which theme are you using ? And can you paste the code that you removed? – colbyalbo Commented Aug 6, 2019 at 21:29
  • I updated the information and added links to the code I removed as well as a link to the theme I am using (Wizard - Child theme) – Kasandra Murray Commented Aug 7, 2019 at 0:09
  • I noticed that when I update my page php file to - get_header( 'nonavigation' ) - and I create a header-nonavigation.php file and upload it to the server my site correctly loads the changes, but then removes the changes and reverts back to the header.php file code. Do you know what could be causing this? I have cleared my cache and tried reloading, but I get the same results. – Kasandra Murray Commented Aug 7, 2019 at 0:26
  • I figured out the solution. I'll mark it in a comment below. – Kasandra Murray Commented Aug 7, 2019 at 0:42
  • great, glad you got it working – colbyalbo Commented Aug 7, 2019 at 14:14
Add a comment  | 

1 Answer 1

Reset to default 0

I found the solutions:

I created a duplicate header and footer file named them header-nonavigation.php and footer-none.php

In these files, I deleted the navigation code and the footer code (do not hide the navigation/footer for some reason it won't load the correct php header/footer files)

I called to these files in my page template php file as get_header('nonavigation') and get_footer('none').

This accomplished exactly what I needed. Whether I am logged in or out the navigation and footer no longer appear.

Here is a screenshot:

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745263478a4619319.html

相关推荐

  • php - Page template not working when logged out

    I created a page template that removes the navigation and footer coder (while still keeping the call to the style sheet

    11小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信