Making WordPress.org

Changeset 3686


Ignore:
Timestamp:
07/15/2016 07:03:17 PM (9 years ago)
Author:
coffee2code
Message:

Handbook plugin: Configure sidebar to use <aside> instead of <li> by default.

But temporarily undo the new configuration if running under P2 since its styling already targets the default output.

File:
1 edited

Legend:

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

    r3683 r3686  
    326326
    327327    function handbook_sidebar() {
    328         register_sidebar( array(
     328        $sidebar_args = array(
    329329            'id'          => $this->post_type,
    330330            'name'        => sprintf( __( '%s Sidebar', 'wporg' ), $this->label ),
    331331            'description' => sprintf( __( 'Used on %s pages', 'wporg' ), $this->label ),
    332         ) );
     332            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
     333            'after_widget'  => '</aside>',
     334            'before_title'  => '<h1 class="widget-title">',
     335            'after_title'   => '</h1>',
     336        );
     337
     338        // P2 usage does not necessitate the custom markup used above.
     339        // This can be removed once all P2s are converted to o2.
     340        if ( class_exists( 'P2' ) ) {
     341            foreach ( array( 'before_widget', 'after_widget', 'before_title', 'after_title' ) as $key ) {
     342                unset( $sidebar_args[ $key ] );
     343            }
     344        }
     345
     346        register_sidebar( $sidebar_args );
     347
    333348        require_once dirname( __FILE__ ) . '/inc/widgets.php';
    334349        register_widget( 'WPorg_Handbook_Pages_Widget' );
Note: See TracChangeset for help on using the changeset viewer.