Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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)

share|improve this question
    
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 Answer 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

share|improve this answer
    
I just saw your own comment above. You can check for the post type by using the get_post_type() function: codex.wordpress.org/Function_Reference/get_post_type –  ZweiBlumen Nov 29 '11 at 21:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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