Changeset 6869 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/functions.php
- Timestamp:
- 03/13/2018 05:00:54 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/functions.php
r6797 r6869 167 167 add_filter( 'page_template_hierarchy', __NAMESPACE__ . '\child_page_templates' ); 168 168 169 function use_opengraph_data_for_embed_template() { 170 global $post; 171 if ( 'page' != $post->post_type || ! $post->page_template || 'default' == $post->page_template ) { 172 return; 173 } 174 175 $meta = custom_open_graph_tags(); 176 if ( $meta ) { 177 add_filter( 'the_title', function( $title ) use( $meta ) { 178 return $meta['og:title'] ?? $title; 179 } ); 180 add_filter( 'the_content', function( $content ) use( $meta ) { 181 return $meta['og:description'] ?? $content; 182 } ); 183 } 184 } 185 add_action( 'embed_head', __NAMESPACE__ . '\use_opengraph_data_for_embed_template' ); 186 169 187 /** 170 188 * Custom template tags. 171 189 */ 172 190 require_once get_stylesheet_directory() . '/inc/template-tags.php'; 191 192 /** 193 * Custom meta descriptions for page templates. 194 */ 195 require_once get_stylesheet_directory() . '/inc/page-meta-descriptions.php';
Note: See TracChangeset
for help on using the changeset viewer.