Changeset 12152
- Timestamp:
- 10/27/2022 04:47:23 PM (3 years ago)
- 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 212 212 213 213 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#L21220 *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;234 214 } 235 215 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/single-wporg-pattern.php
r11283 r12152 9 9 10 10 namespace WordPressdotorg\Pattern_Directory\Theme; 11 use function WordPressdotorg\Pattern_Directory\ Theme\get_all_the_content;11 use function WordPressdotorg\Pattern_Directory\Pattern_Post_Type\decode_pattern_content; 12 12 13 13 get_header(); 14 14 15 $user_has_reported = is_user_logged_in() ? user_has_flagged_pattern() : false; 16 $raw_block_content = get_the_content(); 17 ?> 15 while ( 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 18 22 <input id="block-data" type="hidden" value="<?php echo rawurlencode( wp_json_encode( $raw_block_content ) ); ?>" /> 19 23 <main id="main" class="site-main col-12" role="main"> 20 24 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 --> 25 32 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(); ?> 33 35 34 <div class="entry-content hide-if-pattern-loaded"> 35 <?php the_content(); ?> 36 <hr /> 36 37 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> 38 41 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-## --> 46 43 47 44 </main><!-- #main --> 48 45 49 <?php 46 <?php 47 endwhile; 48 50 49 get_footer();
Note: See TracChangeset
for help on using the changeset viewer.