Ticket #4894: 4894.diff
File 4894.diff, 4.1 KB (added by , 5 years ago) |
---|
-
functions.php
29 29 * Add the BP REST API handbook post type. 30 30 * 31 31 * @since 1.0.0 32 * @since 1.0.1 Renamed as it now registers 2 handbooks. 32 33 * 33 34 * @param array $post_types The list of Handbook post types. 34 35 * @return array The list of Handbook post types. 35 36 */ 36 function bporg_developer_register_rest_api( $post_types = array() ) { 37 $post_types[] = 'bp-rest-api'; 38 return $post_types; 37 function bporg_developer_register_handbooks( $post_types = array() ) { 38 $bp_handbooks = array( 'bp-rest-api', 'bp-gql-api' ); 39 40 return array_merge( $post_types, $bp_handbooks ); 39 41 } 40 add_filter( 'handbook_post_types', __NAMESPACE__ . '\\bporg_developer_register_ rest_api', 100, 1 );42 add_filter( 'handbook_post_types', __NAMESPACE__ . '\\bporg_developer_register_handbooks', 100, 1 ); 41 43 42 44 /** 43 45 * Override the generated Handbook post type label. 44 46 * 45 47 * @since 1.0.0 48 * @since 1.0.1 Renamed as it now labels 2 handbooks. 46 49 * 47 50 * @param string $label The generated Handbook post type label. 48 51 * @param string $post_type The current Handbook post type. 49 52 * @return string The BP REST API post type label. 50 53 */ 51 function bporg_developer_set_ rest_api_label( $label, $post_type ) {54 function bporg_developer_set_handbooks_label( $label, $post_type ) { 52 55 if ( 'bp-rest-api-handbook' === $post_type ) { 53 56 $label = __( 'BP REST API Handbook', 'bporg-developer' ); 57 } elseif ( 'bp-gql-api-handbook' === $post_type ) { 58 $label = __( 'BP GraphQl API Handbook', 'bporg-developer' ); 54 59 } 55 60 56 61 return $label; 57 62 } 58 add_filter( 'handbook_label', __NAMESPACE__ . '\\bporg_developer_set_ rest_api_label', 100, 2 );63 add_filter( 'handbook_label', __NAMESPACE__ . '\\bporg_developer_set_handbooks_label', 100, 2 ); 59 64 60 65 /** 61 66 * Init some starter content for the documentation site. … … 276 281 case 'plugins': 277 282 case 'themes': 278 283 case 'bp-rest-api': 284 case 'bp-gql-api': 279 285 return home_url( '/' . $parts[ 0 ] . '/' ); 280 286 default: 281 287 return apply_filters( 'bporg_developer_get_site_section_url', home_url( '/' ), $parts[ 0 ] ); … … 304 310 return __( 'Theme Handbook', 'bporg-developer' ); 305 311 case 'bp-rest-api': 306 312 return __( 'BP REST API Handbook', 'bporg-developer' ); 313 case 'bp-gql-api': 314 return __( 'BP GraphQl API Handbook', 'bporg-developer' ); 307 315 default: 308 316 return apply_filters( 'bporg_developer_get_site_section_title', __( 'Developer Resources', 'bporg-developer' ) ); 309 317 } -
single-bp-gql-api-handbook.php
1 <?php namespace DevHub; 2 /** 3 * The Template for displaying BP GraphQl API single posts. 4 * 5 * @package bporg-developer 6 * @since 1.0.0 7 */ 8 9 get_header(); ?> 10 11 <?php get_sidebar( 'handbook' ); ?> 12 13 <main id="primary" <?php post_class( 'site-main' ); ?> role="main"> 14 15 <?php breadcrumb_trail(); ?> 16 17 <?php while ( have_posts() ) : the_post(); ?> 18 19 <?php get_template_part( 'content', 'handbook' ); ?> 20 21 <?php \WPorg_Handbook_Navigation::show_nav_links( 'BP GraphQl API Table of Contents' ); ?> 22 23 <?php endwhile; // end of the loop. ?> 24 25 </main><!-- #main --> 26 27 <?php get_footer(); ?> -
single-bp-rest-api-handbook.php
1 1 <?php namespace DevHub; 2 2 /** 3 * The Template for displaying allsingle posts.3 * The Template for displaying BP REST API single posts. 4 4 * 5 5 * @package bporg-developer 6 6 * @since 1.0.0 -
style.css
5 5 Author URI: https://buddypress.org/ 6 6 Template: wporg-developer 7 7 Description: wporg-developer child theme. 8 Version: 1.0. 08 Version: 1.0.1 9 9 License: GNU General Public License 10 10 License URI: license.txt 11 11 Text Domain: bporg-developer