Changeset 7350 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/functions.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/functions.php
r7348 r7350 74 74 if ( is_page( 'stats' ) ) { 75 75 wp_enqueue_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', [], null, true ); 76 wp_enqueue_script( 'wporg-page-stats', get_theme_file_uri( '/js/page-stats.js' ), [ 'jquery', 'google-charts' ], 1, true );76 wp_enqueue_script( 'wporg-page-stats', get_theme_file_uri( '/js/page-stats.js' ), [ 'jquery', 'google-charts' ], 1, true ); 77 77 wp_localize_script( 'wporg-page-stats', 'wporgPageStats', [ 78 78 'trunk' => number_format( WP_CORE_STABLE_BRANCH + 0.1, 1 ), /* trunk */ … … 159 159 160 160 // We want it before page-{page_name}.php but after {Page Template}.php. 161 $page_name_index = array_search( "page-{$page->post_name}.php", $templates );161 $page_name_index = array_search( "page-{$page->post_name}.php", $templates, true ); 162 162 $top = array_slice( $templates, 0, $page_name_index ); 163 163 $bottom = array_slice( $templates, $page_name_index ); 164 164 165 $templates = array_merge( $top, [ "page-{$parent->post_name}-{$page->post_name}.php"], $bottom );165 $templates = array_merge( $top, [ "page-{$parent->post_name}-{$page->post_name}.php" ], $bottom ); 166 166 } 167 167 … … 187 187 add_filter( 'theme_page_templates', __NAMESPACE__ . '\rosetta_page_templates' ); 188 188 189 /** 190 * Passes SEO-optimized title and description to embeds. 191 */ 189 192 function use_opengraph_data_for_embed_template() { 190 193 global $post; 191 if ( 'page' != $post->post_type || ! $post->page_template || 'default' == $post->page_template ) { 194 195 if ( 'page' !== $post->post_type || ! $post->page_template || 'default' === $post->page_template ) { 192 196 return; 193 197 } … … 195 199 $meta = custom_open_graph_tags(); 196 200 if ( $meta ) { 197 add_filter( 'the_title', function( $title ) use ( $meta ) {201 add_filter( 'the_title', function( $title ) use ( $meta ) { 198 202 return $meta['og:title'] ?? $title; 199 203 } ); 200 add_filter( 'the_content', function( $content ) use ( $meta ) {204 add_filter( 'the_content', function( $content ) use ( $meta ) { 201 205 return $meta['og:description'] ?? $content; 202 206 } ); … … 208 212 * Custom template tags. 209 213 */ 210 require_once get_stylesheet_directory(). '/inc/template-tags.php';214 require_once __DIR__ . '/inc/template-tags.php'; 211 215 212 216 /** 213 217 * Custom meta descriptions for page templates. 214 218 */ 215 require_once get_stylesheet_directory(). '/inc/page-meta-descriptions.php';219 require_once __DIR__ . '/inc/page-meta-descriptions.php'; 216 220 217 221 /** 218 222 * Include reCAPTCHA functions for privacy requests. 219 223 */ 220 include __DIR__ . '/inc/recaptcha.php';224 require_once __DIR__ . '/inc/recaptcha.php'; 221 225 222 226 /** 223 227 * Include the Privacy request functions. 224 228 */ 225 include __DIR__ . '/inc/privacy-functions.php';229 require_once __DIR__ . '/inc/privacy-functions.php';
Note: See TracChangeset
for help on using the changeset viewer.