filter_content(); } /** * Display editor for page editor control. * * @since 1.1.51 */ public function customize_editor() { ?>
$frontpage_id, 'post_content' => wp_kses_post( $content ), ); wp_update_post( $post ); } } $thumbnail = get_theme_mod( 'hestia_feature_thumbnail', get_template_directory_uri() . '/assets/img/contact.jpg' ); $thumbnail_id = attachment_url_to_postid( $thumbnail ); update_post_meta( $frontpage_id, '_thumbnail_id', $thumbnail_id ); break; } update_option( 'hestia_sync_needed', false ); } /** * This function updates controls from customizer (about content and featured background) when you change your * frontpage. * * @deprecated 2.0.9 */ public function update_frontpage_change() { $pid = $_POST['pid']; $return_value = array(); $content = get_post_field( 'post_content', $pid ); set_theme_mod( 'hestia_page_editor', $content ); $featured_image = ''; if ( has_post_thumbnail( $pid ) ) { $featured_image = get_the_post_thumbnail_url( $pid ); } else { $thumbnail = get_theme_mod( 'hestia_feature_thumbnail', get_template_directory_uri() . '/assets/img/contact.jpg' ); if ( $thumbnail === get_template_directory_uri() . '/assets/img/contact.jpg' ) { $featured_image = get_template_directory_uri() . '/assets/img/contact.jpg'; } } set_theme_mod( 'hestia_feature_thumbnail', $featured_image ); $return_value['post_content'] = $content; $return_value['post_thumbnail'] = $featured_image; echo json_encode( $return_value ); die(); } /** * Hestia allow all HTML tags in TinyMce editor. * * @param array $init_array TinyMce settings. * * @return array */ public function override_tinymce_options( $init_array ) { $opts = '*[*]'; $init_array['valid_elements'] = $opts; $init_array['extended_valid_elements'] = $opts; return $init_array; } /** * Change the default mode of the editor to html when using the tinyMce editor in customizer. * * @param string $editor_mode The current mode of the default editor. * * @return string The new mode (visual or html) of the editor, if we are in the customizer page. */ public function change_editor_mode_to_html( $editor_mode ) { if ( is_customize_preview() && function_exists( 'get_current_screen' ) ) { $screen = get_current_screen(); if ( ! isset( $screen->id ) ) { return $editor_mode; } if ( $screen->id === 'customize' ) { return 'tmce'; } } return $editor_mode; } /** * This filter is used to filter the content of the post after it is retrieved from the database and before it is * printed to the screen. * Initial we've applied 'the_content' filter but that was wrong because it relies on the global $post being set. * Otherwise, it can break plugins. See https://github.com/Codeinwp/hestia-pro/issues/309 for the issue. * For more explanations check this link https://themehybrid.com/weblog/how-to-apply-content-filters */ private function filter_content() { global $wp_embed; add_filter( 'hestia_text', 'wptexturize' ); add_filter( 'hestia_text', 'convert_smilies' ); add_filter( 'hestia_text', 'convert_chars' ); add_filter( 'hestia_text', 'wpautop' ); add_filter( 'hestia_text', 'shortcode_unautop' ); add_filter( 'hestia_text', 'do_shortcode' ); add_filter( 'hestia_text', array( $wp_embed, 'run_shortcode' ) ); add_filter( 'hestia_text', array( $wp_embed, 'autoembed' ) ); } }