WordPress.org

Making WordPress.org

Changeset 3563


Ignore:
Timestamp:
06/23/2016 06:59:17 PM (5 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Implement Handbooks table of contents functionality for the "More Information" sections of parsed post types.

Props DrewAPicture.
Fixes #1548.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php

    r2984 r3563  
    8484        <section class="explanation">
    8585            <h2><?php _e( 'More Information', 'wporg' ); ?></h2>
    86             <?php echo apply_filters( 'the_content', apply_filters( 'get_the_content', $explanation ) ); ?>
     86
     87            <?php
     88            // Output the explanation. Passed through 'the_content' on retrieval, thus no escaping.
     89            echo $explanation;
     90            ?>
    8791        </section>
    8892    <?php endif; ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r3379 r3563  
    13181318            return '';
    13191319        }
    1320         return get_post_field( $field, $explanation, $context );
     1320
     1321        $post_field = get_post_field( $field, $explanation, $context );
     1322
     1323        // If retrieving the explanation content for display, add the TOC if available.
     1324        if ( 'post_content' === $field && 'display' === $context ) {
     1325            if ( class_exists( 'WPorg_Handbook_TOC' ) ) :
     1326                $TOC = new \WPorg_Handbook_TOC( get_parsed_post_types() );
     1327
     1328                add_filter( 'the_content', array( $TOC, 'add_toc' ) );
     1329                $post_field = apply_filters( 'the_content', apply_filters( 'get_the_content', $post_field ) );
     1330                remove_filter( 'the_content', array( $TOC, 'add_toc' ) );
     1331            else :
     1332                $post_field = apply_filters( 'the_content', apply_filters( 'get_the_content', $post_field ) );
     1333            endif;
     1334        }
     1335
     1336        return $post_field;
    13211337    }
    13221338
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss

    r3379 r3563  
    10541054            margin-top: 30px;
    10551055        }
     1056        .table-of-contents {
     1057            width: 300px;
     1058        }
    10561059    }
    10571060
     
    16111614                text-indent: -45px;
    16121615            }
     1616
     1617            .table-of-contents {
     1618                width: 200px;
     1619            }
    16131620        }
    16141621
     
    16421649                font-size: 16px;
    16431650            }
     1651            .table-of-contents {
     1652                width: 100%;
     1653                margin-bottom: 10px;
     1654            }
    16441655        }
    16451656
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css

    r3379 r3563  
    12631263  margin-top: 30px;
    12641264}
     1265.devhub-wrap .wp-parser-class .table-of-contents, .devhub-wrap .wp-parser-function .table-of-contents, .devhub-wrap .wp-parser-hook .table-of-contents, .devhub-wrap .wp-parser-method .table-of-contents {
     1266  width: 300px;
     1267}
    12651268.devhub-wrap .callout:before {
    12661269  top: 0.2em;
     
    16691672    text-indent: -45px;
    16701673  }
     1674  .devhub-wrap .wp-parser-class .table-of-contents, .devhub-wrap .wp-parser-function .table-of-contents, .devhub-wrap .wp-parser-hook .table-of-contents, .devhub-wrap .wp-parser-method .table-of-contents {
     1675    width: 200px;
     1676  }
    16711677  .devhub-wrap .two-columns .box {
    16721678    width: 99%;
     
    16911697    font-size: 16px;
    16921698  }
     1699  .devhub-wrap .wp-parser-class .table-of-contents, .devhub-wrap .wp-parser-function .table-of-contents, .devhub-wrap .wp-parser-hook .table-of-contents, .devhub-wrap .wp-parser-method .table-of-contents {
     1700    width: 100%;
     1701    margin-bottom: 10px;
     1702  }
    16931703  .devhub-wrap.single-wp-parser-function .comment-list li, .devhub-wrap.single-wp-parser-method .comment-list li, .devhub-wrap.single-wp-parser-hook .comment-list li {
    16941704    padding-left: 0;
Note: See TracChangeset for help on using the changeset viewer.