Changeset 1274 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php
- Timestamp:
- 02/17/2015 11:18:19 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php
r1243 r1274 55 55 56 56 /** 57 * Makes an API request to retrieve the right themes for the current query.58 *59 * @param WP_Query $query60 * @return WP_Query61 */62 function wporg_themes_set_up_query( $query ) {63 if ( is_admin() || in_array( $query->query_vars['pagename'], array( 'upload', 'commercial' ) ) || 'nav_menu_item' == $query->get( 'post_type' ) ) {64 return $query;65 }66 67 $query->set( 'post_type', 'repopackage' );68 69 $args = array(70 'per_page' => 15,71 'fields' => array(72 'description' => true,73 'sections' => false,74 'tested' => true,75 'requires' => true,76 'rating' => true,77 'downloaded' => true,78 'downloadlink' => true,79 'last_updated' => true,80 'homepage' => true,81 'tags' => true,82 'num_ratings' => true,83 'parent' => true,84 ),85 );86 87 if ( $query->query_vars['tag'] ) {88 $args['tag'][] = $query->query_vars['tag'];89 }90 elseif ( $query->query_vars['author_name'] ) {91 $args['author'] = $query->query_vars['author_name'];92 }93 elseif ( $query->query_vars['pagename'] ) {94 $slugs = explode( '/', $query->query_vars['pagename'] );95 96 if ( count( $slugs ) > 1 && 'browse' == $slugs[0] ) {97 $args['browse'] = $slugs[1];98 } else {99 $args['theme'] = $slugs[0];100 }101 }102 else {103 $args['browse'] = 'featured';104 }105 106 if ( ! function_exists( 'themes_api' ) ) {107 include ABSPATH . 'wp-admin/includes/theme.php';108 }109 $GLOBALS['themes'] = themes_api( 'query_themes', $args );110 111 return $query;112 }113 add_filter( 'pre_get_posts', 'wporg_themes_set_up_query' );114 115 /**116 57 * Enqueue scripts and styles. 117 58 */ … … 123 64 wp_enqueue_style( 'wporg-themes-style', get_stylesheet_uri() ); 124 65 125 wp_enqueue_script( 'google-jsapi', '//www.google.com/jsapi', array( ), null );66 wp_enqueue_script( 'google-jsapi', '//www.google.com/jsapi', array( 'jquery' ), null ); 126 67 127 68 if ( ! is_singular( 'page' ) ) { … … 199 140 */ 200 141 function wporg_themes_api_args( $args, $action ) { 201 if ( 'query_themes' == $action) {142 if ( in_array( $action, array( 'query_themes', 'theme_information' ) ) ) { 202 143 $args->per_page = 30; 203 144 $args->fields['parent'] = true;
Note: See TracChangeset
for help on using the changeset viewer.