Making WordPress.org


Ignore:
Timestamp:
07/02/2018 12:47:04 PM (8 years ago)
Author:
netweb
Message:

Support Hub: Update Support Hub to latest changes via GitHub

References:

Props clorith, kenshino, netweb.
See #3485.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/table-of-contents-lite/includes/class-table-of-contents-lite.php

    r7306 r7354  
    223223        public function add_toc( $content ) {
    224224
     225                if ( ! is_singular() ) {
     226                        return $content;
     227                }
     228
    225229                $toc = '';
    226230
     
    236240                if ( $items ) {
    237241                        $contents_header = sprintf( 'h%s', $items[0][2] );
    238                         $toc .= '<div class="table-of-contents">';
    239                         $toc .= '<h2 class="toc-title">' . __( 'Topics', 'wporg-forums' ) . '</h2>';
    240                         $toc .= '<ul class="items">';
    241                         $last_item = false;
     242                        $toc            .= '<div class="table-of-contents">';
     243                        $toc            .= '<h2 class="toc-title">' . __( 'Topics', 'wporg-forums' ) . '</h2>';
     244                        $toc            .= '<ul class="items">';
     245                        $last_item       = false;
    242246                        foreach ( $items as $item ) {
    243247                                if ( $last_item ) {
     
    251255                                }
    252256                                $last_item = $item[2];
    253                                 $toc       .= sprintf( '<li><a href="#%1s">%2s</a>', sanitize_title_with_dashes( $item[3] ), $item[3] );
     257                                $toc      .= sprintf( '<li><a href="#%1s">%2s</a>', sanitize_title_with_dashes( $item[3] ), $item[3] );
    254258                        }
    255259                        $toc .= '</ul></div>';
Note: See TracChangeset for help on using the changeset viewer.