Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Theme previewer: Hide admin bar only on preview pages.
  • Loading branch information
ryelle committed Apr 25, 2024
commit fd866d6c14e57fdb0acbe421d967e1f4c0050f3d
15 changes: 14 additions & 1 deletion source/wp-content/themes/wporg-themes-2024/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,20 @@
// Remove filters added by plugin.
remove_filter( 'post_thumbnail_html', 'wporg_themes_post_thumbnail_html', 10, 5 );

add_filter( 'show_admin_bar', '__return_false', 2000 );
// Hide admin bar on preview pages.
add_filter(
'show_admin_bar',
function( $should_show ) {
global $wp_query;

if ( isset( $wp_query->query_vars['view'] ) ) {
return false;
}

return $should_show;
},
2000
);

/**
* Temporary fix for permission problem during local install.
Expand Down