Skip to content

Instantly share code, notes, and snippets.

@zephyrmike
Last active November 25, 2025 19:15
Show Gist options
  • Select an option

  • Save zephyrmike/2cc4f8d463a0358faeb14869acf41949 to your computer and use it in GitHub Desktop.

Select an option

Save zephyrmike/2cc4f8d463a0358faeb14869acf41949 to your computer and use it in GitHub Desktop.
PHP snippets for GeneretePress and GenerateBlocks
// remove pages from search results
function exclude_pages_from_search( $query ) {
if ( $query->is_search() && $query->is_main_query() && ! is_admin() ) {
$query->set( 'post_type', 'post' );
}
}
add_filter( 'pre_get_posts','exclude_pages_from_search' );
// view customizer additional css in the WP editor
add_filter( 'block_editor_settings_all', function( $editor_settings ) {
$css = wp_get_custom_css_post()->post_content;
$editor_settings['styles'][] = array( 'css' => $css );
return $editor_settings;
} );
// view child theme css in the WP editor
function my_editor_styles() {
add_editor_style( 'editor.css' );
}
add_action( 'after_setup_theme', 'my_editor_styles' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment