Last active
November 25, 2025 19:15
-
-
Save zephyrmike/2cc4f8d463a0358faeb14869acf41949 to your computer and use it in GitHub Desktop.
PHP snippets for GeneretePress and GenerateBlocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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