wpautop example



/** * Performs wpautop() on the shortcode block content. * * @param array $attributes The block attributes. * @param string $content The block content. * * @return string Returns the block content. */
function render_block_core_shortcode( $attributes$content ) {
    return wpautop( $content );
}

/** * Registers the `core/shortcode` block on server. */
function register_block_core_shortcode() {
    register_block_type_from_metadata(
        __DIR__ . '/shortcode',
        array(
            'render_callback' => 'render_block_core_shortcode',
        )
    );

            $text = apply_filters( 'widget_text_content', $text$instance$this );
        } else {
            // Now in legacy mode, add paragraphs and line breaks when checkbox is checked.             if ( ! empty( $instance['filter'] ) ) {
                $text = wpautop( $text );
            }

            /* * Manually do shortcodes on the content when the core-added filter is present. It is added by default * in core by adding do_shortcode() to the 'widget_text_content' filter to apply after wpautop(). * Since the legacy Text widget runs wpautop() after 'widget_text' filters are applied, the widget in * legacy mode here manually applies do_shortcode() on the content unless the default * core filter for 'widget_text_content' has been removed, or if do_shortcode() has already * been applied via a plugin adding do_shortcode() to 'widget_text' filters. */
            if ( has_filter( 'widget_text_content', 'do_shortcode' ) && ! $widget_text_do_shortcode_priority ) {
                

        return apply_filters( 'richedit_pre', '' );
    }

    $output = convert_chars($text);
    $output = wpautop($output);
    $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );

    /** This filter is documented in wp-includes/deprecated.php */
    return apply_filters( 'richedit_pre', $output );
}

/** * Formats text for the HTML editor. * * Unless $output is empty it will pass through htmlspecialchars before the * {@see 'htmledit_pre'} filter is applied. * * @since 2.5.0 * @deprecated 4.3.0 Use format_for_editor() * @see format_for_editor() * * @param string $output The text to be formatted. * @return string Formatted text after filter applied. */

    public function add_privacy_policy_content() {
        if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
            return;
        }
        $content = '<p class="privacy-policy-tutorial">' . __( 'Twenty Twenty-One uses LocalStorage when Dark Mode support is enabled.', 'twentytwentyone' ) . '</p>'
                . '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:', 'twentytwentyone' ) . '</strong> '
                . __( 'This website uses LocalStorage to save the setting when Dark Mode support is turned on or off.<br> LocalStorage is necessary for the setting to work and is only used when a user clicks on the Dark Mode button.<br> No data is saved in the database or transferred.', 'twentytwentyone' );
        wp_add_privacy_policy_content( __( 'Twenty Twenty-One', 'twentytwentyone' )wp_kses_post( wpautop( $content, false ) ) );
    }

}
get_header();

$description = get_the_archive_description();
?> <?php if ( have_posts() ) : ?> <header class="page-header alignwide"> <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?> <?php if ( $description ) : ?> <div class="archive-description"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> <?php endif; ?> </header><!-- .page-header --> <?php while ( have_posts() ) : ?> <?php the_post(); ?> <?php get_template_part( 'template-parts/content/content', get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) ); ?> <?php endwhile; ?> <?php twenty_twenty_one_the_posts_navigation(); ?> <?php else : ?>


            if ( $attributes['displayDate'] ) {
                $list_items_markup .= sprintf(
                    '<time datetime="%1$s" class="wp-block-latest-comments__comment-date">%2$s</time>',
                    esc_attr( get_comment_date( 'c', $comment ) ),
                    date_i18n( get_option( 'date_format' )get_comment_date( 'U', $comment ) )
                );
            }
            $list_items_markup .= '</footer>';
            if ( $attributes['displayExcerpt'] ) {
                $list_items_markup .= '<div class="wp-block-latest-comments__comment-excerpt">' . wpautop( get_comment_excerpt( $comment ) ) . '</div>';
            }
            $list_items_markup .= '</article></li>';
        }
    }

    $classnames = array();
    if ( $attributes['displayAvatar'] ) {
        $classnames[] = 'has-avatars';
    }
    if ( $attributes['displayDate'] ) {
        $classnames[] = 'has-dates';
    }
Home | Imprint | This part of the site doesn't use cookies.