最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

actions - Manually add admin bar

programmeradmin3浏览0评论

Does anyone know how to include the admin bar in a page template where wp_head() and wp_footer() are not present? I'm developing a template other scripts and styles are just getting in the way. Rather than go through and dequeue all of the stuff I don't need, I've simple removed the two hooks altogether. All I want instead is the admin bar.

Thanks!

Does anyone know how to include the admin bar in a page template where wp_head() and wp_footer() are not present? I'm developing a template other scripts and styles are just getting in the way. Rather than go through and dequeue all of the stuff I don't need, I've simple removed the two hooks altogether. All I want instead is the admin bar.

Thanks!

Share Improve this question asked Sep 5, 2014 at 19:21 jamiljamil 4764 silver badges9 bronze badges 1
  • Admin bar is printed in the wp_footer(). javascript and style files needed by the admin bar are enqueued in wp_head() (or in wp_footer() if the enqueue order has been modified by a plugin/theme). Not sure if you can easily do what you are trying. – cybmeta Commented Sep 5, 2014 at 20:34
Add a comment  | 

2 Answers 2

Reset to default 0

From Codex:

<?php show_admin_bar( $bool ); ?>

I think you can get it to work by calling the action that renders the bar in your template like this:

<?php do_action( 'wp_footer','wp_admin_bar_render' ); ?>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论