Changeset 2716
- Timestamp:
- 03/08/2016 10:11:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r2696 r2716 114 114 'supports' => array( 'title', 'editor', 'author', 'custom-fields', 'page-attributes' ), 115 115 'taxonomies' => array( 'category', 'post_tag', 'type' ), 116 'public' => false,116 'public' => true, 117 117 'show_ui' => true, 118 118 'has_archive' => true, … … 905 905 906 906 /** 907 * Correct the post type for theme queries to be "repopackage". 907 * Correct the post type for theme queries to be "repopackage". This fixes the post type for embeds. 908 908 */ 909 909 function wporg_themes_adjust_main_query( $query ) { … … 914 914 add_action( 'pre_get_posts', 'wporg_themes_adjust_main_query'); 915 915 916 /** 917 * Fix the oembed post finder to find the theme post id from the url properly 918 */ 919 function wporg_themes_embed_request_post_id( $post_id, $url ) { 920 if ( preg_match('|https://wordpress\.org/themes/(.*)/|', $url, $matches) ){ 921 $name = $matches[1]; 922 $query = new WP_Query( array( 923 'name' => $name, 924 'post_type' => 'repopackage', 925 'fields' => 'ids', 926 )); 927 if ( $query->posts ) { 928 $post_id = $query->posts[0]; 929 } 930 } 931 return $post_id; 932 } 933 add_filter( 'oembed_request_post_id', 'wporg_themes_embed_request_post_id', 10, 2 ); 934 935 916
Note: See TracChangeset
for help on using the changeset viewer.