/disable-gutenberg.php Secret
Last active
November 10, 2021 18:07
Snippet examples
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
<?php | |
/** | |
* Disable "Gutenberg" editor for "Posts" | |
*/ | |
function bis_disable_gutenberg( $use_block_editor, $post_type ) { | |
if ( $post_type == 'post' ) { | |
return false; | |
} | |
return $use_block_editor; | |
} | |
add_filter( 'use_block_editor_for_post_type', 'bis_disable_gutenberg', 10, 2 ); |
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
<?php | |
/** | |
* Change the default excerpt length | |
*/ | |
function bis_change_excerpt_length( $length ) { | |
return 20; | |
} | |
add_filter( 'excerpt_length', 'bis_change_excerpt_length', 10 ); |
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
<?php | |
/** | |
* Add Google Analytics Tracking. | |
*/ | |
function bis_add_google_analytics_code() { | |
?> | |
<!-- Google Analytics --> | |
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-XXXXX-Y', 'auto'); | |
ga('send', 'pageview'); | |
</script> | |
<!-- End Google Analytics --> | |
<?php | |
} | |
add_action( 'wp_footer', 'bis_add_google_analytics_code' ); |
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
<?php | |
/** | |
* Remove obsolete Emoji scripts from HTML source in front-end | |
*/ | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action( 'embed_head', 'print_emoji_detection_script' ); |
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
<?php | |
/** | |
* Change author & pagination rewrite base/slug | |
*/ | |
function bis_change_pagination_base() { | |
global $wp_rewrite; | |
$wp_rewrite->pagination_base = 'strona'; | |
$wp_rewrite->author_base = 'autor'; | |
$wp_rewrite->author_structure = '/' . $wp_rewrite->author_base . '/%author%'; | |
} | |
add_action( 'init', 'bis_change_pagination_base', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment