Making WordPress.org

Changeset 554


Ignore:
Timestamp:
04/24/2014 10:19:39 PM (12 years ago)
Author:
coffee2code
Message:

Update theme for developer.wordpress.org to the version being developed on GitHub.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
39 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/footer.php

    r69 r554  
    1 </div> <!-- /#wrapper -->
     1<?php
     2/**
     3 * The template for displaying the footer.
     4 *
     5 * Contains the closing of the #content div and all content after
     6 *
     7 * @package wporg-developer
     8 */
     9?>
     10
     11        </div><!-- #content -->
     12
     13</div><!-- #page -->
    214
    315<?php
     16
    417require WPORGPATH . 'footer.php';
    5 
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php

    r69 r554  
    11<?php
    22
    3 
    4 add_action( 'wp_enqueue_scripts', 'theme_scripts_styles' );
     3namespace DevHub;
     4
     5/**
     6 * Custom template tags for this theme.
     7 */
     8require __DIR__ . '/inc/template-tags.php';
     9
     10/**
     11 * Custom functions that act independently of the theme templates.
     12 */
     13require __DIR__ . '/inc/extras.php';
     14
     15/**
     16 * Customizer additions.
     17 */
     18require __DIR__ . '/inc/customizer.php';
     19
     20/**
     21 * Load Jetpack compatibility file.
     22 */
     23require __DIR__ . '/inc/jetpack.php';
     24
     25if ( ! function_exists( 'loop_pagination' ) ) {
     26        require __DIR__ . '/inc/loop-pagination.php';
     27}
     28
     29if ( ! function_exists( 'breadcrumb_trail' ) ) {
     30        require __DIR__ . '/inc/breadcrumb-trail.php';
     31}
     32
     33/**
     34 * Set the content width based on the theme's design and stylesheet.
     35 */
     36if ( ! isset( $content_width ) ) {
     37        $content_width = 640; /* pixels */
     38}
     39
     40
     41add_action( 'init', __NAMESPACE__ . '\\init' );
     42
     43
     44function init() {
     45
     46        register_post_types();
     47        register_taxonomies();
     48        add_action( 'widgets_init', __NAMESPACE__ . '\\widgets_init' );
     49        add_action( 'pre_get_posts', __NAMESPACE__ . '\\pre_get_posts' );
     50        add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\theme_scripts_styles' );
     51        add_filter( 'post_type_link', __NAMESPACE__ . '\\method_permalink', 10, 2 );
     52        add_theme_support( 'automatic-feed-links' );
     53        add_theme_support( 'post-thumbnails' );
     54
     55        // Temporarily disable comments
     56        add_filter( 'comments_open', '__return_false' );
     57}
     58
     59
     60/**
     61 * widgets_init function.
     62 *
     63 * @access public
     64 * @return void
     65 */
     66function widgets_init() {
     67        register_sidebar( array(
     68                'name'          => __( 'Sidebar', 'wporg' ),
     69                'id'            => 'sidebar-1',
     70                'before_widget' => '<aside id="%1$s" class="box gray widget %2$s">',
     71                'after_widget'  => '</div></aside>',
     72                'before_title'  => '<h1 class="widget-title">',
     73                'after_title'   => '</h1><div class="widget-content">',
     74        ) );
     75}
     76
     77/**
     78 * @param \WP_Query $query
     79 */
     80function pre_get_posts( $query ) {
     81
     82        if ( $query->is_main_query() && $query->is_post_type_archive() ) {
     83                $query->set( 'orderby', 'title' );
     84                $query->set( 'order', 'ASC' );
     85        }
     86}
     87
     88/**
     89 * Register the function and class post types
     90 */
     91function register_post_types() {
     92        $supports = array(
     93                'comments',
     94                'custom-fields',
     95                'editor',
     96                'excerpt',
     97                'revisions',
     98                'title',
     99        );
     100
     101        // Functions
     102        register_post_type( 'wp-parser-function', array(
     103                'has_archive' => 'reference/functions',
     104                'label'       => __( 'Functions', 'wporg' ),
     105                'labels'      => array(
     106                        'name'               => __( 'Functions', 'wporg' ),
     107                        'singular_name'      => __( 'Function', 'wporg' ),
     108                        'all_items'          => __( 'Functions', 'wporg' ),
     109                        'new_item'           => __( 'New Function', 'wporg' ),
     110                        'add_new'            => __( 'Add New', 'wporg' ),
     111                        'add_new_item'       => __( 'Add New Function', 'wporg' ),
     112                        'edit_item'          => __( 'Edit Function', 'wporg' ),
     113                        'view_item'          => __( 'View Function', 'wporg' ),
     114                        'search_items'       => __( 'Search Functions', 'wporg' ),
     115                        'not_found'          => __( 'No Functions found', 'wporg' ),
     116                        'not_found_in_trash' => __( 'No Functions found in trash', 'wporg' ),
     117                        'parent_item_colon'  => __( 'Parent Function', 'wporg' ),
     118                        'menu_name'          => __( 'Functions', 'wporg' ),
     119                ),
     120                'public'      => true,
     121                'rewrite'     => array(
     122                        'feeds'      => false,
     123                        'slug'       => 'reference/function',
     124                        'with_front' => false,
     125                ),
     126                'supports'    => $supports,
     127        ) );
     128
     129        // Methods
     130        add_rewrite_rule( 'method/([^/]+)/([^/]+)/?$', 'index.php?post_type=wp-parser-function&name=$matches[1]-$matches[2]', 'top' );
     131
     132        // Classes
     133        register_post_type( 'wp-parser-class', array(
     134                'has_archive' => 'reference/classes',
     135                'label'       => __( 'Classes', 'wporg' ),
     136                'labels'      => array(
     137                        'name'               => __( 'Classes', 'wporg' ),
     138                        'singular_name'      => __( 'Class', 'wporg' ),
     139                        'all_items'          => __( 'Classes', 'wporg' ),
     140                        'new_item'           => __( 'New Class', 'wporg' ),
     141                        'add_new'            => __( 'Add New', 'wporg' ),
     142                        'add_new_item'       => __( 'Add New Class', 'wporg' ),
     143                        'edit_item'          => __( 'Edit Class', 'wporg' ),
     144                        'view_item'          => __( 'View Class', 'wporg' ),
     145                        'search_items'       => __( 'Search Classes', 'wporg' ),
     146                        'not_found'          => __( 'No Classes found', 'wporg' ),
     147                        'not_found_in_trash' => __( 'No Classes found in trash', 'wporg' ),
     148                        'parent_item_colon'  => __( 'Parent Class', 'wporg' ),
     149                        'menu_name'          => __( 'Classes', 'wporg' ),
     150                ),
     151                'public'      => true,
     152                'rewrite'     => array(
     153                        'feeds'      => false,
     154                        'slug'       => 'reference/class',
     155                        'with_front' => false,
     156                ),
     157                'supports'    => $supports,
     158        ) );
     159
     160        // Hooks
     161        register_post_type( 'wp-parser-hook', array(
     162                'has_archive' => 'reference/hooks',
     163                'label'       => __( 'Hooks', 'wporg' ),
     164                'labels'      => array(
     165                        'name'               => __( 'Hooks', 'wporg' ),
     166                        'singular_name'      => __( 'Hook', 'wporg' ),
     167                        'all_items'          => __( 'Hooks', 'wporg' ),
     168                        'new_item'           => __( 'New Hook', 'wporg' ),
     169                        'add_new'            => __( 'Add New', 'wporg' ),
     170                        'add_new_item'       => __( 'Add New Hook', 'wporg' ),
     171                        'edit_item'          => __( 'Edit Hook', 'wporg' ),
     172                        'view_item'          => __( 'View Hook', 'wporg' ),
     173                        'search_items'       => __( 'Search Hooks', 'wporg' ),
     174                        'not_found'          => __( 'No Hooks found', 'wporg' ),
     175                        'not_found_in_trash' => __( 'No Hooks found in trash', 'wporg' ),
     176                        'parent_item_colon'  => __( 'Parent Hook', 'wporg' ),
     177                        'menu_name'          => __( 'Hooks', 'wporg' ),
     178                ),
     179                'public'      => true,
     180                'rewrite'     => array(
     181                        'feeds'      => false,
     182                        'slug'       => 'reference/hook',
     183                        'with_front' => false,
     184                ),
     185                'supports'    => $supports,
     186        ) );
     187
     188        // Methods
     189        register_post_type( 'wp-parser-method', array(
     190                'has_archive' => 'reference/methods',
     191                'label'       => __( 'Methods', 'wporg' ),
     192                'labels'      => array(
     193                        'name'               => __( 'Methods', 'wporg' ),
     194                        'singular_name'      => __( 'Method', 'wporg' ),
     195                        'all_items'          => __( 'Methods', 'wporg' ),
     196                        'new_item'           => __( 'New Method', 'wporg' ),
     197                        'add_new'            => __( 'Add New', 'wporg' ),
     198                        'add_new_item'       => __( 'Add New Method', 'wporg' ),
     199                        'edit_item'          => __( 'Edit Method', 'wporg' ),
     200                        'view_item'          => __( 'View Method', 'wporg' ),
     201                        'search_items'       => __( 'Search Methods', 'wporg' ),
     202                        'not_found'          => __( 'No Methods found', 'wporg' ),
     203                        'not_found_in_trash' => __( 'No Methods found in trash', 'wporg' ),
     204                        'parent_item_colon'  => __( 'Parent Method', 'wporg' ),
     205                        'menu_name'          => __( 'Methods', 'wporg' ),
     206                ),
     207                'public'      => true,
     208                'rewrite'     => array(
     209                        'feeds'      => false,
     210                        'slug'       => 'method',
     211                        'with_front' => false,
     212                ),
     213                'supports'    => $supports,
     214        ) );
     215}
     216
     217/**
     218 * Register the file and @since taxonomies
     219 */
     220function register_taxonomies() {
     221        // Files
     222        register_taxonomy( 'wp-parser-source-file', array( 'wp-parser-class', 'wp-parser-function', 'wp-parser-hook', 'wp-parser-method' ), array(
     223                'label'                 => __( 'Files', 'wporg' ),
     224                'labels'                => array(
     225                        'name'                       => __( 'Files', 'wporg' ),
     226                        'singular_name'              => _x( 'File', 'taxonomy general name', 'wporg' ),
     227                        'search_items'               => __( 'Search Files', 'wporg' ),
     228                        'popular_items'              => null,
     229                        'all_items'                  => __( 'All Files', 'wporg' ),
     230                        'parent_item'                => __( 'Parent File', 'wporg' ),
     231                        'parent_item_colon'          => __( 'Parent File:', 'wporg' ),
     232                        'edit_item'                  => __( 'Edit File', 'wporg' ),
     233                        'update_item'                => __( 'Update File', 'wporg' ),
     234                        'add_new_item'               => __( 'New File', 'wporg' ),
     235                        'new_item_name'              => __( 'New File', 'wporg' ),
     236                        'separate_items_with_commas' => __( 'Files separated by comma', 'wporg' ),
     237                        'add_or_remove_items'        => __( 'Add or remove Files', 'wporg' ),
     238                        'choose_from_most_used'      => __( 'Choose from the most used Files', 'wporg' ),
     239                        'menu_name'                  => __( 'Files', 'wporg' ),
     240                ),
     241                'public'                => true,
     242                'rewrite'               => array( 'slug' => 'reference/files' ),
     243                'sort'                  => false,
     244                'update_count_callback' => '_update_post_term_count',
     245        ) );
     246
     247        // Package
     248        register_taxonomy( 'wp-parser-package', array( 'wp-parser-class', 'wp-parser-function', 'wp-parser-hook', 'wp-parser-method' ), array(
     249                'hierarchical'          => true,
     250                'label'                 => '@package',
     251                'public'                => true,
     252                'rewrite'               => array( 'slug' => 'reference/package' ),
     253                'sort'                  => false,
     254                'update_count_callback' => '_update_post_term_count',
     255        ) );
     256
     257        // @since
     258        register_taxonomy( 'wp-parser-since', array( 'wp-parser-class', 'wp-parser-function', 'wp-parser-hook', 'wp-parser-method' ), array(
     259                'hierarchical'          => true,
     260                'label'                 => __( '@since', 'wporg' ),
     261                'public'                => true,
     262                'rewrite'               => array( 'slug' => 'reference/since' ),
     263                'sort'                  => false,
     264                'update_count_callback' => '_update_post_term_count',
     265        ) );
     266}
     267
     268function method_permalink( $link, $post ) {
     269        if ( $post->post_type !== 'wp-parser-function' || $post->post_parent == 0 )
     270                return $link;
     271
     272        list( $class, $method ) = explode( '-', $post->post_name );
     273        $link = home_url( user_trailingslashit( "method/$class/$method" ) );
     274        return $link;
     275}
     276
    5277function theme_scripts_styles() {
    6         wp_enqueue_style( 'wp-doc-style', get_stylesheet_uri() );
    7         wp_enqueue_style( 'droid-sans-mono', '//fonts.googleapis.com/css?family=Droid+Sans+Mono' );
    8 
    9         ## wp_enqueue_script( 'ace-editor', 'http://rawgithub.com/ajaxorg/ace-builds/master/src-noconflict/ace.js' );
    10 }
    11 
    12 function wp_doc_comment( $comment, $args, $depth ) {
    13         ?>
    14         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    15                 <article id="comment-<?php comment_ID(); ?>" class="comment">
    16 
    17                         <?php if ( $comment->comment_approved == '0' ) : ?>
    18                                 <em class="comment-awaiting-moderation"><?php _e('Your example is awaiting moderation.'); ?></em>
    19                                 <br />
    20                         <?php endif; ?>
    21 
    22                         <pre class="example-content"><?php echo htmlentities( get_comment_text() ); ?></pre>
    23 
    24                         <footer class="comment-meta">
    25                                 <div class="comment-author vcard">
    26                                         <?php
    27                                                 echo get_avatar( $comment );
    28 
    29                                                 /* translators: 1: comment author, 2: date and time */
    30                                                 printf( __('Contributed by %1$s on %2$s'),
    31                                                         sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
    32                                                         sprintf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
    33                                                                 esc_url( get_comment_link( $comment->comment_ID ) ),
    34                                                                 get_comment_time( 'c' ),
    35                                                                 /* translators: 1: date, 2: time */
    36                                                                 sprintf( __('%1$s at %2$s'), get_comment_date(), get_comment_time() )
    37                                                         )
    38                                                 );
    39                                         ?>
    40 
    41                                         <?php edit_comment_link( __('Edit'), '<span class="edit-link">', '</span>' ); ?>
    42                                 </div><!-- .comment-author .vcard -->
    43 
    44                         </footer>
    45 
    46                 </article><!-- #comment-## -->
    47 
    48         <?php
    49 }
    50 
     278        wp_enqueue_style( 'dashicons' );
     279        wp_enqueue_style( 'open-sans', '//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,300,600' );
     280        wp_enqueue_style( 'wporg-developer-style', get_stylesheet_uri() );
     281        wp_enqueue_style( 'wp-dev-sass-compiled', get_template_directory_uri() . '/main.css', array( 'wporg-developer-style' ), '20140424' );
     282        wp_enqueue_script( 'wporg-developer-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
     283        wp_enqueue_script( 'wporg-developer-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
     284        if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
     285                wp_enqueue_script( 'comment-reply' );
     286        }
     287}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/header.php

    r69 r554  
    11<?php
    2 global $pagetitle;
    3 $pagetitle = wp_title( '&laquo;', false, 'right' ) . ' ' . get_bloginfo( 'name' );
    4 wp_enqueue_style( 'wporg-developer', get_bloginfo( 'stylesheet_url' ), array(), 1, 'screen' );
     2/**
     3 * The Header for our theme.
     4 *
     5 * Displays all of the <head> section and everything up till <div id="content">
     6 *
     7 * @package wporg-developer
     8 */
    59require WPORGPATH . 'header.php';
    610?>
    7 <div id="headline">
    8         <div class="wrapper">
    9                 <h2><a href="<?php echo home_url( '/' ); ?>"><?php bloginfo( 'name' ); ?></a></h2>
    10         </div>
    11 </div>
    1211
    13 <div id="wrapper">
     12<div id="page" class="hfeed site devhub-wrap">
     13        <?php do_action( 'before' ); ?>
     14        <header id="masthead" class="site-header" role="banner">
     15                <div class="inner-wrap">
     16                        <div class="site-branding">
     17                                <?php if ( ! is_front_page() ) : ?>
     18                                        <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/reference/' ) ); ?>" rel="home"><?php echo DevHub\get_site_section_title(); ?></a></h1>
     19                                <?php else : ?>
     20                                        <span class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo DevHub\get_site_section_title(); ?></a></span>
     21                                <?php endif; ?>
     22                        </div>
     23                </div><!-- .inner-wrap -->
     24        </header><!-- #masthead -->
     25        <div id="content" class="site-content">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/index.php

    r69 r554  
    1 <?php get_header(); ?>
     1<?php
     2/**
     3 * The main template file.
     4 *
     5 * This is the most generic template file in a WordPress theme
     6 * and one of the two required files for a theme (the other being style.css).
     7 * It is used to display a page when nothing more specific matches a query.
     8 * E.g., it puts together the home page when no home.php file exists.
     9 * Learn more: http://codex.wordpress.org/Template_Hierarchy
     10 *
     11 * @package wporg-developer
     12 */
    213
    3 <div class="pagebody">
    4         <div class="wrapper">
    5                 <?php // get_template_part( 'breadcrumbs' ); ?>
     14get_header(); ?>
    615
    7                 <?php if ( have_posts() ) : the_post(); ?>
     16        <div id="primary" class="content-area has-sidebar">
     17                <main id="main" class="site-main" role="main">
    818
    9                         <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     19                <?php if ( have_posts() ) : ?>
    1020
    11                                 <h1><?php the_title(); ?></h1>
     21                        <?php /* Start the Loop */ ?>
     22                        <?php while ( have_posts() ) : the_post(); ?>
    1223
    13                                 <section class="content">
    14                                         <?php the_content(); ?>
    15                                 </section>
     24                                <?php
     25                                        /* Include the Post-Format-specific template for the content.
     26                                         * If you want to override this in a child theme, then include a file
     27                                         * called content-___.php (where ___ is the Post Format name) and that will be used instead.
     28                                         */
     29                                        get_template_part( 'content', get_post_format() );
     30                                ?>
    1631
    17                                 <?php // comments_template( '/examples.php' ); ?>
     32                        <?php endwhile; ?>
    1833
    19                         </article>
    20                
     34                        <?php wporg_developer_paging_nav(); ?>
     35
    2136                <?php else : ?>
    22                
    23                         <h1><?php _e('Not Found'); ?></h1>
    24                
     37
     38                        <?php get_template_part( 'content', 'none' ); ?>
     39
    2540                <?php endif; ?>
    2641
    27         </div><!-- /wrapper -->
    28 </div><!-- /pagebody -->
     42                <?php loop_pagination(); ?>
    2943
     44                </main><!-- #main -->
     45                <?php get_sidebar(); ?>
     46        </div><!-- #primary -->
    3047<?php get_footer(); ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/style.css

    r69 r554  
    11/*
    2 Theme Name:     WordPress.org Developer Resources
    3 Theme URI:      http://developer.wordpress.org/
    4 Description:    Theme for developer.wordpress.org and the code reference.
    5 Author:         the WordPress team
    6 Author URI:     http://wordpress.org/
    7 Version:        1.0-beta
     2Theme Name: wporg-developer
     3Theme URI: http://underscores.me/
     4Author: Underscores.me
     5Author URI: http://underscores.me/
     6Description: Description
     7Version: 1.0
     8License: GNU General Public License
     9License URI: license.txt
     10Text Domain: wporg-developer
     11Domain Path: /languages/
     12Tags:
     13
     14This theme, like WordPress, is licensed under the GPL.
     15Use it to make something cool, have fun, and share what you've learned with others.
     16
     17 wporg-developer is based on Underscores http://underscores.me/, (C) 2012-2013 Automattic, Inc.
     18
     19Resetting and rebuilding styles have been helped along thanks to the fine work of
     20Eric Meyer http://meyerweb.com/eric/tools/css/reset/index.html
     21along with Nicolas Gallagher and Jonathan Neal http://necolas.github.com/normalize.css/
     22and Blueprint http://www.blueprintcss.org/
    823*/
    9 
    10 p.bbcrumb {
    11         margin: 1em 12px;
    12 }
    13 
    14 article.wpapi-function {
    15         clear: both;
    16         padding: 0 12px;
    17         font-size:1.3em;
    18         margin: 1em 0 4em;
    19 }
    20 
    21 article.wpapi-function h1 {
    22         font-family: 'Droid Sans Mono', Courier New, monospace;
    23         font-size: 1.6em;
    24         margin: 1em 0;
    25 }
    26 article.wpapi-function h1:after {
    27         content: '()';
    28 }
    29 
    30 article.wpapi-function .wpfuncref-prototype {   
    31         font-family: 'Droid Sans Mono', Courier New, Monospace;
    32         font-size: 1.1em;
    33         margin: 1em 0;
    34 }
    35 
    36 article.wpapi-function .wpfuncref-prototype span.type {
    37         font-style: italic;
    38 }
    39 
    40 article.wpapi-function .wpfuncref-prototype span.variable {
    41         color: #21759b;
    42 }
    43 
    44 article.wpapi-function .wpfuncref-description {
    45         font-size: 1.4em;
    46         font-weight: normal;
    47 }
    48 article.wpapi-function h3 {
    49         padding: 1em 0 0.5em;
    50         font-size: 1.7em;
    51 }
    52 article.wpapi-function .wpfuncref-longdesc p {
    53         margin: 1em 0;
    54 }
    55 article.wpapi-function dl {
    56        
    57 }
    58 
    59 article.wpapi-function dl dt {
    60         font-weight: 700;
    61         font-family: 'Droid Sans Mono', Courier New, Monospace;
    62 }
    63 
    64 article.wpapi-function dl dd {
    65         padding: 0 0 1em 1em;
    66         font-style: italic;
    67 }
    68 
    69 article.wpapi-function .wpfuncref-arguments h4 {
    70         border: 0;
    71         padding: 0;
    72         margin: 0;
    73 }
    74 article.wpapi-function .wpfuncref-arg {
    75         margin-bottom: 1em;
    76 }
    77 article.
    78 #comments .comment {
    79         padding-bottom: 5px;
    80         margin-bottom: 10px;
    81 }
    82 
    83 #comments label {
    84         display: block;
    85 }
    86 
    87 #comments #ace-editor {
    88         width: 60%;
    89         height: 250px;
    90         border: 1px solid #ccc;
    91         border-radius: 3px;
    92         margin-bottom: 5px;
    93 }
    94 
    95 #comments .comment .example-content {
    96         margin-bottom: .5em;
    97 }
    98 
    99 #comments .comment-author {
    100         padding: 10px 5px;
    101         height: 12px;
    102         font-size: 12px;
    103 }
    104 
    105 #comments .comment-author img {
    106         height: 32px;
    107         width: auto;
    108         margin: -10px 5px;
    109 }
    110 
    111 #comments .comment-author {
    112        
    113 }
Note: See TracChangeset for help on using the changeset viewer.