<?php
// Enable font size & font family selects in the editor
if ( ! function_exists( 'wpex_mce_buttons' ) ) {
function wpex_mce_buttons( $buttons ) {
array_unshift( $buttons, 'fontselect' ); // Add Font Select
array_unshift( $buttons, 'fontsizeselect' ); // Add Font Size Select
return $buttons;
}
}
add_filter( 'mce_buttons_2', 'wpex_mce_buttons' );
function prefix_tinymce_toolbar( $args ) {
$args['fontsize_formats'] = "8px 10px 12px 13px 14px 16px 18px 20px 22px 24px 26px 28px 32px 36px";
return $args;
}
add_filter( 'tiny_mce_before_init', 'prefix_tinymce_toolbar' );
add_action('wp_enqueue_scripts', 'site_styles');
add_action('wp_enqueue_scripts', 'site_scripts');
function site_styles(){
wp_enqueue_style(' style-site' , get_stylesheet_uri());
wp_enqueue_style(' style-libs' ,get_template_directory_uri() . '/assets/css/libs.min.css');
};
function site_scripts(){
wp_enqueue_script('libs-scripts', get_template_directory_uri() . '/assets/js/libs.min.js', true);
wp_enqueue_script('main-scripts', get_template_directory_uri() . '/assets/js/main.min.js', true);
};
add_action( 'init', 'true_jquery_register' );
function true_jquery_register() {
if ( !is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', ( 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js' ), false, null, true );
wp_enqueue_script( 'jquery' );
}
}
add_theme_support( 'custom-logo' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'menus' );
function my_myme_types($mime_types){
$mime_types['svg'] = 'image/svg+xml'; // поддержка SVG
return $mime_types;
}
add_filter('upload_mimes', 'my_myme_types', 1, 1);
if( !function_exists('my_buttons') ){ function my_buttons()
{ ?>
<script type="text/javascript">
QTags.addButton( 'span', 'span', '<span>', '</span>' );
</script>
<?php }
add_action('admin_print_footer_scripts', 'my_buttons');
}
// запрет проверки плагинов на обнову
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
wp_clear_scheduled_hook( 'wp_update_plugins' );
add_filter('wpcf7_autop_or_not', '__return_false');
//скрыть страницу
add_action( 'pre_get_posts' ,'exclude_this_page' );
function exclude_this_page( $query ) {
if( !is_admin() )
return $query;
global $pagenow;
if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )
$query->set( 'post__not_in', array(144) );
return $query;
}
?>