Making WordPress.org

Changeset 5474


Ignore:
Timestamp:
05/04/2017 04:02:34 PM (8 years ago)
Author:
danielbachhuber
Message:

devhub/cli: Add a basic /cli/commands/ archive page

See #2465

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

Legend:

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

    r5469 r5474  
    1111        add_action( 'init', array( __CLASS__, 'action_init_register_cron_jobs' ) );
    1212        add_action( 'init', array( __CLASS__, 'action_init_register_post_types' ) );
     13        add_action( 'pre_get_posts', array( __CLASS__, 'action_pre_get_posts' ) );
    1314        add_action( 'devhub_cli_manifest_import', array( __CLASS__, 'action_devhub_cli_manifest_import' ) );
    1415        add_action( 'devhub_cli_markdown_import', array( __CLASS__, 'action_devhub_cli_markdown_import' ) );
     
    6263    }
    6364
     65    public static function action_pre_get_posts( $query ) {
     66        if ( $query->is_main_query() && $query->is_post_type_archive( 'command' ) ) {
     67            $query->set( 'post_parent', 0 );
     68            $query->set( 'orderby', 'title' );
     69            $query->set( 'order', 'ASC' );
     70            $query->set( 'posts_per_page', 250 );
     71        }
     72    }
     73
    6474    public static function action_devhub_cli_manifest_import() {
    6575        $response = wp_remote_get( self::$commands_manifest );
Note: See TracChangeset for help on using the changeset viewer.