Making WordPress.org

Changeset 12152


Ignore:
Timestamp:
10/27/2022 04:47:23 PM (4 years ago)
Author:
ryelle
Message:

Pattern Directory: Sync with git WordPress/pattern-directory@fb35733

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php

    r12085 r12152  
    212212
    213213        return $items->have_posts();
    214 }
    215 
    216 /**
    217  * Get the full, filtered content of a post, ignoring more and noteaser tags and pagination.
    218  *
    219  * See https://github.com/WordPress/wordcamp.org/blob/442ea26d8e6a1b39f97114e933842b1ec4f8eef9/public_html/wp-content/mu-plugins/blocks/includes/content.php#L21
    220  *
    221  * @param int|WP_Post $post Post ID or post object.
    222  * @return string The full, filtered post content.
    223  */
    224 function get_all_the_content( $post ) {
    225         $post = get_post( $post );
    226 
    227         $content = wp_kses_post( $post->post_content );
    228 
    229         /** This filter is documented in wp-includes/post-template.php */
    230         $content = apply_filters( 'the_content', $content );
    231         $content = str_replace( ']]>', ']]>', $content );
    232 
    233         return $content;
    234214}
    235215
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/single-wporg-pattern.php

    r11283 r12152  
    99
    1010namespace WordPressdotorg\Pattern_Directory\Theme;
    11 use function WordPressdotorg\Pattern_Directory\Theme\get_all_the_content;
     11use function WordPressdotorg\Pattern_Directory\Pattern_Post_Type\decode_pattern_content;
    1212
    1313get_header();
    1414
    15 $user_has_reported = is_user_logged_in() ? user_has_flagged_pattern() : false;
    16 $raw_block_content = get_the_content();
    17 ?>
     15while ( have_posts() ) :
     16        the_post();
     17
     18        $user_has_reported = is_user_logged_in() ? user_has_flagged_pattern() : false;
     19        $raw_block_content = decode_pattern_content( get_the_content() );
     20        ?>
     21
    1822        <input id="block-data" type="hidden" value="<?php echo rawurlencode( wp_json_encode( $raw_block_content ) ); ?>" />
    1923        <main id="main" class="site-main col-12" role="main">
    2024
    21                 <?php
    22                 while ( have_posts() ) :
    23                         the_post();
    24                         ?>
     25                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     26                        <div
     27                                hidden
     28                                class="pattern__container"
     29                                data-post-id="<?php echo intval( get_the_ID() ); ?>"
     30                                data-user-has-reported="<?php echo json_encode( $user_has_reported ); ?>"
     31                        ></div><!-- .pattern__container -->
    2532
    26                         <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    27                                 <div
    28                                         hidden
    29                                         class="pattern__container"
    30                                         data-post-id="<?php echo intval( get_the_ID() ); ?>"
    31                                         data-user-has-reported="<?php echo json_encode( $user_has_reported ); ?>"
    32                                 ></div><!-- .pattern__container -->
     33                        <div class="entry-content hide-if-pattern-loaded">
     34                                <?php the_content(); ?>
    3335
    34                                 <div class="entry-content hide-if-pattern-loaded">
    35                                         <?php the_content(); ?>
     36                                <hr />
    3637
    37                                         <hr />
     38                                <label for="pattern-code"><?php esc_html_e( 'Pattern Code', 'wporg-patterns' ); ?></label>
     39                                <textarea id="pattern-code" class="pattern-code"><?php echo esc_attr( $raw_block_content ); ?></textarea>
     40                        </div>
    3841
    39                                         <label for="pattern-code"><?php esc_html_e( 'Pattern Code', 'wporg-patterns' ); ?></label>
    40                                         <textarea id="pattern-code" class="pattern-code"><?php echo esc_attr( $raw_block_content ); ?></textarea>
    41                                 </div>
    42 
    43                         </article><!-- #post-## -->
    44 
    45                 <?php endwhile; ?>
     42                </article><!-- #post-## -->
    4643
    4744        </main><!-- #main -->
    4845
    49 <?php
     46        <?php
     47endwhile;
     48
    5049get_footer();
Note: See TracChangeset for help on using the changeset viewer.