wp_kses_post example

 . wp_kses_post( __( '<em>The Hatchery</em>: a blog about my adventures in bird watching', 'twentytwentytwo' ) ) . '</h2> <!-- /wp:heading --></div> <!-- /wp:group --> <!-- wp:image {"align":"full","sizeSlug":"full","linkDestination":"none"} --> <figure class="wp-block-image alignfull size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/flight-path-on-transparent-c.png" alt="' . esc_attr__( 'Illustration of a bird flying.', 'twentytwentytwo' ) . '"/></figure> <!-- /wp:image --></div> <!-- /wp:group --><!-- wp:spacer {"height":66} --> <div style="height:66px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer -->',
);
<?php /** * Page layout with image and text. */
return array(
    'title'      => __( 'Page layout with image and text', 'twentytwentytwo' ),
    'categories' => array( 'pages' ),
    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--large, 8rem)","bottom":"2rem"}}},"layout":{"inherit":true}} --> <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--large, 8rem);padding-bottom:2rem"><!-- wp:heading {"align":"wide","style":{"typography":{"fontSize":"clamp(4rem, 8vw, 7.5rem)","lineHeight":"1.15","fontWeight":"300"}}} --> <h2 class="alignwide" style="font-size:clamp(4rem, 8vw, 7.5rem);font-weight:300;line-height:1.15">' . wp_kses_post( __( '<em>Watching Birds </em><br><em>in the Garden</em>', 'twentytwentytwo' ) ) . '</h2> <!-- /wp:heading --></div> <!-- /wp:group --> <!-- wp:image {"align":"full","style":{"color":{}}} --> <figure class="wp-block-image alignfull"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/flight-path-on-transparent-b.png" alt="' . esc_attr_x( 'TBD', 'Short for to be determined', 'twentytwentytwo' ) . '"/></figure> <!-- /wp:image --> <!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"2rem","bottom":"var(--wp--custom--spacing--large, 8rem)"}}},"layout":{"inherit":true}} --> <div class="wp-block-group alignfull" style="padding-top:2rem;padding-bottom:var(--wp--custom--spacing--large, 8rem)"> <!-- wp:columns {"align":"wide"} --> <div class="wp-block-columns alignwide"><!-- wp:column {"verticalAlignment":"bottom","style":{"spacing":{"padding":{"bottom":"1em"}}}} --> <div class="wp-block-column is-vertically-aligned-bottom" style="padding-bottom:1em"><!-- wp:site-logo {"width":60} /--></div> <!-- /wp:column --> <!-- wp:column {"verticalAlignment":"bottom"} --> <div class="wp-block-column is-vertically-aligned-bottom"><!-- wp:paragraph --> <p>'
 . esc_html__( 'Jesús Rodriguez', 'twentytwentytwo' ) . '</h2> <!-- /wp:heading --></div> <!-- /wp:column --> <!-- wp:column {"verticalAlignment":"center"} --> <div class="wp-block-column is-vertically-aligned-center"><!-- wp:paragraph --> <p>' . wp_kses_post( __( 'The Vintagé Theater<br>245 Arden Rd.<br>Gardenville, NH', 'twentytwentytwo' ) ) . '</p> <!-- /wp:paragraph --></div> <!-- /wp:column --></div> <!-- /wp:columns --> <!-- wp:separator {"color":"background","align":"wide","className":"is-style-wide"} --> <hr class="wp-block-separator alignwide has-text-color has-background has-background-background-color has-background-color is-style-wide"/> <!-- /wp:separator --> <!-- wp:columns {"verticalAlignment":"center","align":"wide"} --> <div class="wp-block-columns alignwide are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","width":"210px"} --> <div class="wp-block-column is-vertically-aligned-center" style="flex-basis:210px"><!-- wp:paragraph --> <p>'
        if ( ( ( 0 < $depth && ! $is_nested ) || $is_nested ) && isset( $colors['overlay_css_classes']$colors['overlay_inline_styles'] ) ) {
            $css_class .= ' ' . trim( implode( ' ', $colors['overlay_css_classes'] ) );
            if ( '' !== $colors['overlay_inline_styles'] ) {
                $style_attribute = sprintf( ' style="%s"', esc_attr( $colors['overlay_inline_styles'] ) );
            }
        }

        if ( (int) $page['page_id'] === $front_page_id ) {
            $css_class .= ' menu-item-home';
        }

        $title      = wp_kses_post( $page['title'] );
        $aria_label = sprintf(
            /* translators: Accessibility text. %s: Parent page title. */
            __( '%s submenu' ),
            wp_strip_all_tags( $title )
        );

        $markup .= '<li class="wp-block-pages-list__item' . esc_attr( $css_class ) . '"' . $style_attribute . '>';

        if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) {
            $markup .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="' . esc_attr( $navigation_child_content_class ) . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . esc_html( $title ) .
            '</button><span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
        }
return array(
    'title'      => __( 'About page with media on the right', 'twentytwentytwo' ),
    'categories' => array( 'pages' ),
    'content'    => '<!-- wp:media-text {"align":"full","mediaPosition":"right","mediaLink":"' . esc_url( get_template_directory_uri() ) . '/assets/images/bird-on-black.jpg","mediaType":"image","style":{"elements":{"link":{"color":{"text":"var:preset|color|background"}}}},"backgroundColor":"foreground","textColor":"background"} --> <div class="wp-block-media-text alignfull has-media-on-the-right is-stacked-on-mobile has-background-color has-foreground-background-color has-text-color has-background has-link-color"><figure class="wp-block-media-text__media"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/bird-on-black.jpg" alt="' . esc_attr__( 'An image of a bird flying', 'twentytwentytwo' ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:spacer {"height":32} --> <div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --> <!-- wp:site-logo {"width":60} /--> <!-- wp:group {"style":{"spacing":{"padding":{"right":"min(8rem, 5vw)","top":"min(20rem, 20vw)"}}}} --> <div class="wp-block-group" style="padding-top:min(20rem, 20vw);padding-right:min(8rem, 5vw)"><!-- wp:heading {"style":{"typography":{"fontWeight":"300","lineHeight":"1.115","fontSize":"clamp(3rem, 6vw, 4.5rem)"}}} --> <h2 style="font-size:clamp(3rem, 6vw, 4.5rem);font-weight:300;line-height:1.115"><em>' . wp_kses_post( __( 'Emery<br>Driscoll', 'twentytwentytwo' ) ) . '</em></h2> <!-- /wp:heading --> <!-- wp:paragraph {"style":{"typography":{"lineHeight":"1.6"}}} --> <p style="line-height:1.6">' . esc_html__( 'Oh hello. My name’s Emery, and you’ve found your way to my website. I’m an avid bird watcher, and I also broadcast my own radio show on Tuesday evenings at 11PM EDT.', 'twentytwentytwo' ) . '</p> <!-- /wp:paragraph --> <!-- wp:spacer {"height":40} --> <div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --> <!-- wp:social-links {"iconColor":"background","iconColorValue":"var(--wp--preset--color--foreground)","iconBackgroundColor":"foreground","iconBackgroundColorValue":"var(--wp--preset--color--background)"} --> <ul class="wp-block-social-links has-icon-color has-icon-background-color"><!-- wp:social-link {"url":"#","service":"wordpress"} /--> <!-- wp:social-link {"url":"#","service":"twitter"} /--> <!-- wp:social-link {"url":"#","service":"instagram"} /--></ul> <!-- /wp:social-links --></div> <!-- /wp:group --></div> <!-- wp:spacer {"height":32} --> <div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --></div> <!-- /wp:media-text -->',


        // Links Area.         register_block_pattern(
            'twentytwentyone/links-area',
            array(
                'title'         => esc_html__( 'Links area', 'twentytwentyone' ),
                'categories'    => array( 'twentytwentyone' ),
                'viewportWidth' => 1440,
                'blockTypes'    => array( 'core/cover' ),
                'description'   => esc_html_x( 'A huge text followed by social networks and email address links.', 'Block pattern description', 'twentytwentyone' ),
                'content'       => '<!-- wp:cover {"overlayColor":"green","contentPosition":"center center","align":"wide","className":"is-style-twentytwentyone-border"} --><div class="wp-block-cover alignwide has-green-background-color has-background-dim is-style-twentytwentyone-border"><div class="wp-block-cover__inner-container"><!-- wp:spacer {"height":20} --><div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:paragraph {"fontSize":"huge"} --><p class="has-huge-font-size">' . wp_kses_post( __( 'Let&#8217;s Connect.', 'twentytwentyone' ) ) . '</p><!-- /wp:paragraph --><!-- wp:spacer {"height":75} --><div style="height:75px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:columns --><div class="wp-block-columns"><!-- wp:column --><div class="wp-block-column"><!-- wp:paragraph --><p><a href="#" data-type="URL">' . esc_html__( 'Twitter', 'twentytwentyone' ) . '</a> / <a href="#" data-type="URL">' . esc_html__( 'Instagram', 'twentytwentyone' ) . '</a> / <a href="#" data-type="URL">' . esc_html__( 'Dribbble', 'twentytwentyone' ) . '</a></p><!-- /wp:paragraph --></div><!-- /wp:column --><!-- wp:column --><div class="wp-block-column"><!-- wp:paragraph --><p><a href="#">' . esc_html__( 'example@example.com', 'twentytwentyone' ) . '</a></p><!-- /wp:paragraph --></div><!-- /wp:column --></div><!-- /wp:columns --><!-- wp:spacer {"height":20} --><div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --></div></div><!-- /wp:cover --><!-- wp:paragraph --><p></p><!-- /wp:paragraph -->',
            )
        );

        // Media & Text Article Title.         register_block_pattern(
            'twentytwentyone/media-text-article-title',
            array(
                'title'         => esc_html__( 'Media and text article title', 'twentytwentyone' ),
                'categories'    => array( 'twentytwentyone' ),
                'viewportWidth' => 1440,
                'description'   => esc_html_x( 'A Media & Text block with a big image on the left and a heading on the right. The heading is followed by a separator and a description paragraph.', 'Block pattern description', 'twentytwentyone' ),
                
__( 'untitled post %s' ),
            $post_ID
        );
    }
    $screen_reader_text = sprintf(
        /* translators: %s is either the post title or post ID to describe the link for screen readers. */
        __( ': %s' ),
        $post_title
    );
    $justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}";
    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) );
    $more_text          = ! empty( $attributes['content'] ) ? wp_kses_post( $attributes['content'] ) : __( 'Read more' );
    return sprintf(
        '<a %1s href="%2s" target="%3s">%4s<span class="screen-reader-text">%5s</span></a>',
        $wrapper_attributes,
        get_the_permalink( $post_ID ),
        esc_attr( $attributes['linkTarget'] ),
        $more_text,
        $screen_reader_text
    );
}

/** * Registers the `core/read-more` block on the server. */
<?php /** * Video with header and details block pattern */
return array(
    'title'      => __( 'Video with header and details', 'twentytwentytwo' ),
    'categories' => array( 'featured', 'columns' ),
    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--large, 8rem)","bottom":"var(--wp--custom--spacing--large, 8rem)"}},"elements":{"link":{"color":{"text":"var:preset|color|secondary"}}}},"backgroundColor":"foreground","textColor":"secondary"} --> <div class="wp-block-group alignfull has-secondary-color has-foreground-background-color has-text-color has-background has-link-color" style="padding-top:var(--wp--custom--spacing--large, 8rem);padding-bottom:var(--wp--custom--spacing--large, 8rem)"><!-- wp:group {"align":"full","layout":{"inherit":true}} --> <div class="wp-block-group alignfull"><!-- wp:heading {"level":1,"align":"wide","style":{"typography":{"fontSize":"clamp(3rem, 6vw, 4.5rem)"}}} --> <h1 class="alignwide" id="warble-a-film-about-hobbyist-bird-watchers-1" style="font-size:clamp(3rem, 6vw, 4.5rem)">' . wp_kses_post( __( '<em>Warble</em>, a film about <br>hobbyist bird watchers.', 'twentytwentytwo' ) ) . '</h1> <!-- /wp:heading --> <!-- wp:spacer {"height":32} --> <div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --> <!-- wp:video {"align":"wide"} --> <figure class="wp-block-video alignwide"><video controls src="' . esc_url( get_template_directory_uri() ) . '/assets/videos/birds.mp4"></video></figure> <!-- /wp:video --> <!-- wp:spacer {"height":32} --> <div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --> <!-- wp:columns {"align":"wide"} --> <div class="wp-block-columns alignwide"><!-- wp:column {"width":"50%"} --> <div class="wp-block-column" style="flex-basis:50%"><!-- wp:paragraph --> <p><strong>'

    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 ) ) );
    }

}
$prefix .= '<span class="wp-block-post-terms__prefix">' . $attributes['prefix'] . '</span>';
    }

    $suffix = '</div>';
    if ( isset( $attributes['suffix'] ) && $attributes['suffix'] ) {
        $suffix = '<span class="wp-block-post-terms__suffix">' . $attributes['suffix'] . '</span>' . $suffix;
    }

    return get_the_term_list(
        $block->context['postId'],
        $attributes['term'],
        wp_kses_post( $prefix ),
        '<span class="wp-block-post-terms__separator">' . esc_html( $separator ) . '</span>',
        wp_kses_post( $suffix )
    );
}

/** * Registers the `core/post-terms` block on the server. */
function register_block_core_post_terms() {
    $taxonomies = get_taxonomies(
        array(
            

return array(
    'title'      => __( 'Poster with right sidebar', 'twentytwentytwo' ),
    'categories' => array( 'pages' ),
    'content'    => '<!-- wp:group {"align":"full","layout":{"inherit":true}} --> <div class="wp-block-group alignfull"><!-- wp:columns {"align":"wide","style":{"spacing":{"blockGap":"5%"}}} --> <div class="wp-block-columns alignwide"><!-- wp:column {"width":"70%"} --> <div class="wp-block-column" style="flex-basis:70%"> <!-- wp:heading {"level":1,"align":"wide","style":{"typography":{"fontSize":"clamp(3rem, 6vw, 4.5rem)"},"spacing":{"margin":{"bottom":"0px"}}}} --> <h1 class="alignwide" style="font-size:clamp(3rem, 6vw, 4.5rem);margin-bottom:0px">' . wp_kses_post( __( '<em>Flutter</em>, a collection of bird-related ephemera', 'twentytwentytwo' ) ) . '</h1> <!-- /wp:heading --></div> <!-- /wp:column --> <!-- wp:column {"width":""} --> <div class="wp-block-column"></div> <!-- /wp:column --></div> <!-- /wp:columns --> <!-- wp:columns {"align":"wide","style":{"spacing":{"blockGap":"5%"}}} --> <div class="wp-block-columns alignwide"><!-- wp:column {"width":"70%","style":{"spacing":{"padding":{"bottom":"32px"}}}} --> <div class="wp-block-column" style="padding-bottom:32px;flex-basis:70%"><!-- wp:image {"sizeSlug":"full","linkDestination":"none"} --> <figure class="wp-block-image size-full"><img src="'
<?php /** * Page layout with two columns. */
return array(
    'title'      => __( 'Page layout with two columns', 'twentytwentytwo' ),
    'categories' => array( 'pages' ),
    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--large, 8rem)","bottom":"var(--wp--custom--spacing--large, 8rem)"}}},"layout":{"inherit":true}} --> <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--large, 8rem);padding-bottom:var(--wp--custom--spacing--large, 8rem);"><!-- wp:heading {"level":1,"align":"wide","style":{"typography":{"fontSize":"clamp(4rem, 15vw, 12.5rem)","lineHeight":"1","fontWeight":"200"}}} --> <h1 class="alignwide" style="font-size:clamp(4rem, 15vw, 12.5rem);font-weight:200;line-height:1">' . wp_kses_post( __( '<em>Goldfinch </em><br><em>&amp; Sparrow</em>', 'twentytwentytwo' ) ) . '</h1> <!-- /wp:heading --> <!-- wp:spacer {"height":50} --> <div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --> <!-- wp:group {"align":"wide","layout":{"inherit":false}} --> <div class="wp-block-group alignwide"><!-- wp:columns --> <div class="wp-block-columns"><!-- wp:column {"verticalAlignment":"center","width":"20%"} --> <div class="wp-block-column is-vertically-aligned-center" style="flex-basis:20%"><!-- wp:paragraph --> <p>' . esc_html__( 'WELCOME', 'twentytwentytwo' ) . '</p> <!-- /wp:paragraph --></div> <!-- /wp:column --> <!-- wp:column {"verticalAlignment":"center","width":"80%"} --> <div class="wp-block-column is-vertically-aligned-center" style="flex-basis:80%"><!-- wp:separator {"className":"is-style-wide"} --> <hr class="wp-block-separator is-style-wide"/> <!-- /wp:separator --></div> <!-- /wp:column --></div> <!-- /wp:columns --></div> <!-- /wp:group --> <!-- wp:columns {"align":"wide"} --> <div class="wp-block-columns alignwide"><!-- wp:column --> <div class="wp-block-column"><!-- wp:paragraph --> <p>'
return $value;
        }

        if ( isset( $value['raw_instance'] ) && $id_base && wp_use_widgets_block_editor() ) {
            $widget_object = $wp_widget_factory->get_widget_object( $id_base );
            if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) {
                if ( 'block' === $id_base && ! current_user_can( 'unfiltered_html' ) ) {
                    /* * The content of the 'block' widget is not filtered on the fly while editing. * Filter the content here to prevent vulnerabilities. */
                    $value['raw_instance']['content'] = wp_kses_post( $value['raw_instance']['content'] );
                }

                return $value['raw_instance'];
            }
        }

        if (
            empty( $value['is_widget_customizer_js_value'] ) ||
            empty( $value['instance_hash_key'] ) ||
            empty( $value['encoded_serialized_instance'] )
        ) {
            

        ?> <?php if ( is_singular() ) : ?> <figure class="post-thumbnail"> <?php                 // Lazy-loading attributes should be skipped for thumbnails since they are immediately in the viewport.                 the_post_thumbnail( 'post-thumbnail', array( 'loading' => false ) );
                ?> <?php if ( wp_get_attachment_caption( get_post_thumbnail_id() ) ) : ?> <figcaption class="wp-caption-text"><?php echo wp_kses_post( wp_get_attachment_caption( get_post_thumbnail_id() ) ); ?></figcaption> <?php endif; ?> </figure><!-- .post-thumbnail --> <?php else : ?> <figure class="post-thumbnail"> <a class="post-thumbnail-inner alignwide" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1"> <?php the_post_thumbnail( 'post-thumbnail' ); ?> </a> <?php if ( wp_get_attachment_caption( get_post_thumbnail_id() ) ) : ?> <figcaption class="wp-caption-text"><?php echo wp_kses_post( wp_get_attachment_caption( get_post_thumbnail_id() ) ); ?></figcaption>
$link  = $label;
    }

    // If we want to also show the page title, make the page title a link and prepend the label.     if ( isset( $attributes['showTitle'] ) && $attributes['showTitle'] ) {
        /* * If the label link option is not enabled but there is a custom label, * display the custom label as text before the linked title. */
        if ( ! $attributes['linkLabel'] ) {
            if ( $label ) {
                $format = '<span class="post-navigation-link__label">' . wp_kses_post( $label ) . '</span> %link';
            }
            $link = '%title';
        } elseif ( isset( $attributes['linkLabel'] ) && $attributes['linkLabel'] ) {
            // If the label link option is enabled and there is a custom label, display it before the title.             if ( $label ) {
                $link = '<span class="post-navigation-link__label">' . wp_kses_post( $label ) . '</span> <span class="post-navigation-link__title">%title</span>';
            } else {
                /* * If the label link option is enabled and there is no custom label, * add a colon between the label and the post title. */
                
Home | Imprint | This part of the site doesn't use cookies.