0

I have a post type/single page that I'm using to create iframe widgets for embedding on other sites and blogs. The admin bar code is creating that extra 28px space at the top, and if I try to include it in a wordpress text widget, it screws with the existing admin bar on the hosting site for the iframe. I'm using a custom single and custom header file, wondering how I can lose the bar and css associated with it entirely just for that content. Thanks! (also posted on wordpress.org)

  • I can't answer my own question yet, cause I'm new, but here's the solution I found, from yoast: in functions.php: if ( isset($_GET['bar']) && 'no' == $_GET['bar'] ) add_filter( 'show_admin_bar', '__return_false' ); "This would allow you to disable the WordPress admin bar by going to example.com/?bar=no, you can of course change those values." documentation: yoast.com/disable-wp-admin-bar This will work for my purposes, but requires a custom url. if anyone has any alternate suggestions, I'd be interested. – Wendy Nov 29 '11 at 21:37
1

You can add some code into your theme's functions.php file that checks the post type or whatever condition you want and when the condition is met, add this filter:

add_filter( ‘show_admin_bar’, ‘__return_false’ );

See this codex page for more information:

http://codex.wordpress.org/Plugin_API/Filter_Reference/show_admin_bar

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.