Making WordPress.org

Changeset 9424


Ignore:
Timestamp:
01/24/2020 08:35:39 PM (2 years ago)
Author:
coffee2code
Message:

Handbook plugin: Add post state for handbook landing page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php

    r9416 r9424  
    139139        add_filter( 'comments_open',                      array( $this, 'comments_open' ), 10, 2 );
    140140        add_filter( 'wp_nav_menu_objects',                array( $this, 'highlight_menu_handbook_link' ) );
    141     }
    142 
     141        add_filter( 'display_post_states',                array( $this, 'display_post_states' ), 10, 2 );
     142    }
     143
     144    /**
     145     * Adds 'Handbook Front Page' post state indicator for handbook landing pages.
     146     *
     147     * @param string[] $post_states An array of post display states.
     148     * @param WP_Post  $post        The current post object.
     149     * @return string[]
     150     */
     151    function display_post_states( $post_states, $post ) {
     152        if ( $this->post_is_landing_page( $post ) ) {
     153            $post_states[] = __( 'Handbook Front Page', 'wporg' );
     154        }
     155        return $post_states;
     156    }
     157   
    143158    /**
    144159     * Adds custom handbook-related classes to body tag.
Note: See TracChangeset for help on using the changeset viewer.