admin管理员组文章数量:1417713
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
1 Answer
Reset to default 0I 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:
本文标签: phpPage template not working when logged out
版权声明:本文标题:php - Page template not working when logged out 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745263478a2650464.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论