Wordpress 管理栏未显示在网站前端
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7214647/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Wordpress Admin Bar Not Showing on frontend of site
提问by dtechplus
Please could anyone help me with this problem? The wordpress admin bar is not displaying on the front-end (public visible pages) of my website. It shows when I'm logged in at the backend i.e Dashboard though. User settings are ok (set to show admin bar when viewing the site). I have tried deactivating (then, re-activating ) installed plugins, still no show.
请问有人能帮我解决这个问题吗?wordpress 管理栏未显示在我网站的前端(公共可见页面)上。它显示我何时在后端登录,即仪表板。用户设置没问题(设置为在查看站点时显示管理栏)。我试过停用(然后重新激活)已安装的插件,但仍然没有显示。
Just a background note:I recently transferred the site to my webhost (I was developing locally and everything worked and is still working). And I have a custom folder for wordpress. I was wondering if the problem has to do with this.
只是一个背景说明:我最近将站点转移到我的网络主机(我在本地开发,一切正常,并且仍在工作)。我有一个用于 wordpress 的自定义文件夹。我想知道问题是否与此有关。
Please help I have searched everywhere but seems everyone is looking to hidethe admin panel instead.
请帮助我到处搜索,但似乎每个人都希望隐藏管理面板。
Thanks in advance
提前致谢
回答by ksemel
Check that your theme includes a call to the function wp_footer()
at some point, usually at the very bottom of footer.php. That generates the code required for the admin bar to show.
检查您的主题是否wp_footer()
在某个时间点包含对该函数的调用,通常位于 footer.php 的最底部。这将生成管理栏显示所需的代码。
回答by Nils
add this to the end of your footer.php
in your theme folder:
将此添加到footer.php
主题文件夹的末尾:
<?php wp_footer(); ?>
problem solved :-)
问题解决了 :-)
回答by AdamJB
Most of the time the wp_footer() call is right where it should be so if you still can't see the admin bar then try the following:
大多数时候 wp_footer() 调用是正确的,所以如果您仍然看不到管理栏,请尝试以下操作:
- log out of the backend
- navigate to the front-end
- clear your browser cache
log back in using the absolute url i.e. yourwebsite.co.uk/wp-admin
and then see if it comes up - worked for me.
- 退出后台
- 导航到前端
- 清除浏览器缓存
使用绝对网址重新登录,即 yourwebsite.co.uk/wp-admin
然后看看它是否出现 - 对我来说有效。
Also make sure the "Show Toolbar when viewing site" box is checked in your user profile page or whatever you try ain't gonna work my friend!.
还要确保在您的用户个人资料页面中选中了“查看站点时显示工具栏”框,或者您尝试的任何内容都不起作用,我的朋友!。
回答by Travis Pflanz
I know this is an old question, but another option - If you purchased (use) a pre-made theme make sure that theme does not remove the toolbar in its code.
我知道这是一个老问题,但另一种选择 - 如果您购买(使用)预制主题,请确保该主题不会删除其代码中的工具栏。
回答by anmari
Does it 'know' that you are logged in ? when in front end ? ie: meta widget shows 'logout' instead of login. if not Did you by any chance play around with the cookie paths?
它“知道”您已登录吗?什么时候在前端?即:元小部件显示“注销”而不是登录。如果没有,您是否有机会玩弄 cookie 路径?
I got myself confused because I was logged in at backend, but not front end. This was because I'd being playing with the cookie path and forgot to uncomment what I'd done.
我让自己感到困惑,因为我是在后端登录的,而不是前端登录。这是因为我正在玩 cookie 路径,忘记取消注释我所做的事情。
回答by squarecandy
First, double checked all of the other items mentioned here (wp_footer()
, etc).
首先,仔细检查此处提到的所有其他项目(wp_footer()
等)。
Three more things to check:
还要检查三件事:
- make sure header.php has
<body <?php body_class(); ?>>
not just<body>
- try disabling plugins one by one if you're still having trouble. (For me, the Simplest Gallery 2.7 with WP 3.7.1 caused a conflict that made the admin bar disappear)
- look for
function remove_admin_bar() { return false; }
in the theme's functions.php - change it toreturn true
.
- 确保 header.php
<body <?php body_class(); ?>>
不只是<body>
- 如果您仍然遇到问题,请尝试一一禁用插件。(对我来说,带有 WP 3.7.1 的 Simplest Gallery 2.7 引起了冲突,导致管理栏消失)
function remove_admin_bar() { return false; }
在主题的functions.php 中查找- 将其更改为return true
.
回答by MattKnowles
For me the issue was that I was using http://mydomain.com/wpin the WordPress address but http://www.mydomain.comfor the site address. We had added the www to the WordPress address so that GoogleAnalytics would work and that's when the Admin Bar broke.
对我来说,问题是我在 WordPress 地址中使用了http://mydomain.com/wp,但在站点地址中使用了http://www.mydomain.com。我们已将 www 添加到 WordPress 地址,以便 GoogleAnalytics 可以工作,而那时管理栏已损坏。
Adding www to the WordPress address fixed the issue.
将 www 添加到 WordPress 地址解决了该问题。
回答by Gianluca Lodigiani
Just add in your template
<?php wp_footer(); ?>
before </body>
and <?php wp_head(); ?>
before </head>
只需在您的模板
<?php wp_footer(); ?>
之前</body>
和<?php wp_head(); ?>
之前添加</head>
回答by Moneymakerspy
Make sure site addresses are the same! I had one set at http://www.example.comand the other (WordPress) address set to http://example.comor visa versa.
确保站点地址相同!我在http://www.example.com设置了一个地址,另一个 (WordPress) 地址设置为http://example.com,反之亦然。
I had them set this way because I though it was needed for the site to show up when you type the url without the www.
我将它们设置为这种方式,因为我认为当您键入不带 www 的 url 时,网站需要显示。
Now that both addresses are the same (with the www) my admin bar works, I stay logged in, I can comment, see preview or draft content, cross-site authenticate and logout, wow!
现在两个地址都相同(带有 www),我的管理栏可以正常工作,我保持登录状态,我可以发表评论、查看预览或草稿内容、跨站点身份验证和注销,哇!
an entire year of wondering why WP just never worked right across over 30 websites!
一整年想知道为什么 WP 从来没有在 30 多个网站上正常工作!
Going to change addresses to the same "www" address in the rest of my 30 sites now and enjoy error-free WordPress for the first time ever...it's a great day!
现在要在我的其余 30 个站点中将地址更改为相同的“www”地址,并有史以来第一次享受无错误的 WordPress……这是美好的一天!
Remember to remove any admin bar code you may have added in your theme's function.php file or in your styles.CSS
请记住删除您可能在主题的 function.php 文件或 style.CSS 中添加的任何管理条码
Thanks to all who help us here!
感谢所有在这里帮助我们的人!
回答by Allon
To clarify after a lot of searching for a solution, similar to MattKnowles solution but more specific: Make sure that in settings > WordPress Address (URL) and settings > Site address (URL) that if one has www then the other also does and the other way round. Otherwise it seems while you are browsing the site it is a different domain to the admin area and the admin bar does not show.
在大量搜索解决方案后澄清,类似于 MattKnowles 解决方案,但更具体:确保在设置 > WordPress 地址(URL)和设置 > 站点地址(URL)中,如果一个人有 www,那么另一个人也有,并且另一边。否则,当您浏览站点时,它似乎与管理区域不同,并且不会显示管理栏。