| Server IP : 54.216.143.184 / Your IP : 172.31.22.179 Web Server : Apache/2.4.68 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2 System : Linux ip-172-31-10-208.eu-west-1.compute.internal 6.8.0-1044-aws #46~22.04.1-Ubuntu SMP Tue Dec 2 12:52:18 UTC 2025 x86_64 User : kazang ( 1006) PHP Version : 8.2.31 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/kazang/web/kazang.com/public_html/wp-content/themes/understrap/inc/ |
Upload File : |
<?php
/**
* Understrap modify editor
*
* @package Understrap
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
add_action( 'admin_init', 'understrap_wpdocs_theme_add_editor_styles' );
if ( ! function_exists( 'understrap_wpdocs_theme_add_editor_styles' ) ) {
/**
* Registers an editor stylesheet for the theme.
*/
function understrap_wpdocs_theme_add_editor_styles() {
add_editor_style( 'css/custom-editor-style.min.css' );
}
}
add_filter( 'mce_buttons_2', 'understrap_tiny_mce_style_formats' );
if ( ! function_exists( 'understrap_tiny_mce_style_formats' ) ) {
/**
* Reveals TinyMCE's hidden Style dropdown.
*
* @param array $buttons Array of Tiny MCE's button ids.
* @return array
*/
function understrap_tiny_mce_style_formats( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
}
add_filter( 'tiny_mce_before_init', 'understrap_tiny_mce_before_init' );
if ( ! function_exists( 'understrap_tiny_mce_before_init' ) ) {
/**
* Adds style options to TinyMCE's Style dropdown.
*
* @param array $settings TinyMCE settings array.
* @return array
*/
function understrap_tiny_mce_before_init( $settings ) {
$style_formats = array(
array(
'title' => __( 'Lead Paragraph', 'understrap' ),
'selector' => 'p',
'classes' => 'lead',
'wrapper' => true,
),
array(
'title' => _x( 'Small', 'Font size name', 'understrap' ),
'inline' => 'small',
),
array(
'title' => __( 'Blockquote', 'understrap' ),
'block' => 'blockquote',
'classes' => 'blockquote',
'wrapper' => true,
),
array(
'title' => __( 'Blockquote Footer', 'understrap' ),
'block' => 'footer',
'classes' => 'blockquote-footer',
'wrapper' => true,
),
array(
'title' => __( 'Cite', 'understrap' ),
'inline' => 'cite',
),
);
if ( isset( $settings['style_formats'] ) ) {
$orig_style_formats = json_decode( $settings['style_formats'], true );
if ( is_array( $orig_style_formats ) ) {
$style_formats = array_merge( $orig_style_formats, $style_formats );
}
}
$settings['style_formats'] = wp_json_encode( $style_formats );
/*
* Fix TinyMCE editor body margin that is set to 0 by Bootstrap's
* _reboot.scss (v4 & v5). `margin: 9px 10px` is the value used by WP's
* TinyMCE skin (/wp-includes/js/tinymce/skins/wordpress/wp-content.css).
*/
if ( isset( $settings['content_style'] ) ) {
$settings['content_style'] .= ' body#tinymce { margin: 9px 10px; }';
} else {
$settings['content_style'] = 'body#tinymce { margin: 9px 10px; }';
}
return $settings;
}
}
add_filter( 'mce_buttons', 'understrap_tiny_mce_blockquote_button' );
if ( ! function_exists( 'understrap_tiny_mce_blockquote_button' ) ) {
/**
* Removes the blockquote button from the TinyMCE toolbar.
*
* We provide the blockquote via the style formats. Using the style formats
* blockquote receives the proper Bootstrap classes.
*
* @since 1.0.0
*
* @see understrap_tiny_mce_before_init()
*
* @param array $buttons TinyMCE buttons array.
* @return array TinyMCE buttons array without the blockquote button.
*/
function understrap_tiny_mce_blockquote_button( $buttons ) {
foreach ( $buttons as $key => $button ) {
if ( 'blockquote' === $button ) {
unset( $buttons[ $key ] );
}
}
return $buttons;
}
}