Making WordPress.org

Ticket #4894: 4894.diff

File 4894.diff, 4.1 KB (added by imath, 4 years ago)
  • functions.php

     
    2929 * Add the BP REST API handbook post type.
    3030 *
    3131 * @since 1.0.0
     32 * @since 1.0.1 Renamed as it now registers 2 handbooks.
    3233 *
    3334 * @param  array $post_types The list of Handbook post types.
    3435 * @return array The list of Handbook post types.
    3536 */
    36 function bporg_developer_register_rest_api( $post_types = array() ) {
    37         $post_types[] = 'bp-rest-api';
    38         return $post_types;
     37function 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 );
    3941}
    40 add_filter( 'handbook_post_types', __NAMESPACE__ . '\\bporg_developer_register_rest_api', 100, 1 );
     42add_filter( 'handbook_post_types', __NAMESPACE__ . '\\bporg_developer_register_handbooks', 100, 1 );
    4143
    4244/**
    4345 * Override the generated Handbook post type label.
    4446 *
    4547 * @since 1.0.0
     48 * @since 1.0.1 Renamed as it now labels 2 handbooks.
    4649 *
    4750 * @param  string $label     The generated Handbook post type label.
    4851 * @param  string $post_type The current Handbook post type.
    4952 * @return string The BP REST API post type label.
    5053 */
    51 function bporg_developer_set_rest_api_label( $label, $post_type ) {
     54function bporg_developer_set_handbooks_label( $label, $post_type ) {
    5255        if ( 'bp-rest-api-handbook' === $post_type ) {
    5356                $label = __( 'BP REST API Handbook', 'bporg-developer' );
     57        } elseif ( 'bp-gql-api-handbook' === $post_type ) {
     58                $label = __( 'BP GraphQl API Handbook', 'bporg-developer' );
    5459        }
    5560
    5661        return $label;
    5762}
    58 add_filter( 'handbook_label', __NAMESPACE__ . '\\bporg_developer_set_rest_api_label', 100, 2 );
     63add_filter( 'handbook_label', __NAMESPACE__ . '\\bporg_developer_set_handbooks_label', 100, 2 );
    5964
    6065/**
    6166 * Init some starter content for the documentation site.
     
    276281                case 'plugins':
    277282                case 'themes':
    278283                case 'bp-rest-api':
     284                case 'bp-gql-api':
    279285                        return home_url( '/' . $parts[ 0 ] . '/' );
    280286                default:
    281287                        return apply_filters( 'bporg_developer_get_site_section_url', home_url( '/' ), $parts[ 0 ] );
     
    304310                        return __( 'Theme Handbook', 'bporg-developer' );
    305311                case 'bp-rest-api':
    306312                        return __( 'BP REST API Handbook', 'bporg-developer' );
     313                case 'bp-gql-api':
     314                        return __( 'BP GraphQl API Handbook', 'bporg-developer' );
    307315                default:
    308316                        return apply_filters( 'bporg_developer_get_site_section_title', __( 'Developer Resources', 'bporg-developer' ) );
    309317        }
  • 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
     9get_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

     
    11<?php namespace DevHub;
    22/**
    3  * The Template for displaying all single posts.
     3 * The Template for displaying BP REST API single posts.
    44 *
    55 * @package bporg-developer
    66 * @since 1.0.0
  • style.css

     
    55Author URI: https://buddypress.org/
    66Template: wporg-developer
    77Description: wporg-developer child theme.
    8 Version: 1.0.0
     8Version: 1.0.1
    99License: GNU General Public License
    1010License URI: license.txt
    1111Text Domain: bporg-developer