Changeset 7350 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-about-testimonials.php
- Timestamp:
- 06/29/2018 08:57:02 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-about-testimonials.php
r6972 r7350 7 7 * @package WordPressdotorg\MainTheme 8 8 */ 9 10 // phpcs:disable WordPress.VIP.RestrictedFunctions 9 11 10 12 namespace WordPressdotorg\MainTheme; … … 23 25 } ); 24 26 25 / / See inc/page-meta-descriptions.php for the meta description for this page.27 /* See inc/page-meta-descriptions.php for the meta description for this page. */ 26 28 27 // Pull list of testimonial URLs from the news page holding them 29 // Pull list of testimonial URLs from the news page holding them. 28 30 switch_to_blog( 8 ); 29 $test page= get_page_by_path( 'testimonials' );31 $testimonials_post = get_page_by_path( 'testimonials' ); 30 32 restore_current_blog(); 31 33 32 // we only need the URLs in the post_content 33 preg_match_all( '|https://\S+|', $testpage->post_content, $testimonials ); 34 $testimonials = $testimonials[0]; 34 if ( $testimonials_post instanceof \WP_Post ) { 35 // We only need the URLs in the post_content. 36 preg_match_all( '|https://\S+|', $testimonials_post->post_content, $testimonials ); 37 $testimonials = $testimonials[0]; 38 } else { 39 $testimonials = []; 40 } 35 41 36 // separate out the twiiter from the WPs 37 $embed_tweets = array_values( array_filter( $testimonials, function ($t) { return strpos( $t, 'https://twitter.com' ) === 0; } ) ); 38 $embed_wps = array_values( array_filter( $testimonials, function ($t) { return strpos( $t, 'https://twitter.com' ) !== 0; } ) ); 42 // Separate out the twitter from the WPs. 43 $embed_tweets = array_values( array_filter( $testimonials, function( $t ) { 44 return strpos( $t, 'https://twitter.com' ) === 0; 45 } ) ); 46 $embed_wps = array_values( array_filter( $testimonials, function( $t ) { 47 return strpos( $t, 'https://twitter.com' ) !== 0; 48 } ) ); 39 49 40 // Randomize the tweet order 50 // Randomize the tweet order. 41 51 shuffle( $embed_tweets ); 42 52 43 // Strip out everything but the Tweet ID 53 // Strip out everything but the Tweet ID. 44 54 array_walk( $embed_tweets, function ( &$tweet ) { 45 55 $tweet = preg_replace( '|https?://twitter.com/.*/status/([0-9]+)|', '$1', $tweet ); … … 70 80 conversation: 'none', 71 81 cards: 'hidden', 72 margin: 0, width: 372 82 margin: 0, 83 width: 372 73 84 } 74 85 ).then( function() { … … 92 103 wp_add_inline_script( 'twitter-widgets', $custom_js ); 93 104 wp_localize_script( 'twitter-widgets', 'embeds', array( 94 'tweets' => $embed_tweets,105 'tweets' => $embed_tweets, 95 106 'wpembeds' => $embed_wps, 96 107 ) ); … … 107 118 108 119 <div class="entry-content row"> 109 110 120 <section class="col-8"> 111 <h3><?php _e( 'Share your WordPress story', 'wporg' ); ?></h3> 112 113 <p><?php _e( 'Want to have your story featured on this page?', 'wporg' ); ?></p> 114 115 <p><?php 121 <h3><?php esc_html_e( 'Share your WordPress story', 'wporg' ); ?></h3> 122 <p><?php esc_html_e( 'Want to have your story featured on this page?', 'wporg' ); ?></p> 123 <p> 124 <?php 116 125 /* translators: Link to the twitter #ilovewp feed */ 117 printf( __( "Make a blog post with your story and tweet a link to it using the <a href='%s'>#ilovewp</a> hashtag. We'll select the best ones and feature them here!", 'wporg' ), 'https://twitter.com/search?q=%23ilovewp' ); 118 ?></p> 126 printf( wp_kses_post( __( 'Make a blog post with your story and tweet a link to it using the <a href="%s">#ilovewp</a> hashtag. We’ll select the best ones and feature them here!', 'wporg' ) ), 'https://twitter.com/search?q=%23ilovewp' ); 127 ?> 128 </p> 119 129 120 130 <p> … … 126 136 </a> 127 137 </p> 128 129 138 </section> 130 139 131 <section class="col-10" id="embeds"> 132 </section> 140 <section class="col-10" id="embeds"></section> 133 141 </div><!-- .entry-content --> 134 135 142 </article><!-- #post-## --> 136 143
Note: See TracChangeset
for help on using the changeset viewer.