WordPress.org

Making WordPress.org

Ticket #1802: 1802_handbook.diff

File 1802_handbook.diff, 1.2 KB (added by DrewAPicture, 5 years ago)

Handbook changes

  • inc/table-of-contents.php

     
    99
    1010        protected $styles = '<style> .toc-jump { text-align: right; font-size: 12px; } .page .toc-heading { margin-top: -50px; padding-top: 50px !important; }</style>';
    1111
    12         function __construct( $post_types ) {
     12        protected $header_text;
     13
     14        function __construct( $post_types, $header_text = '' ) {
    1315                $this->post_types = (array) $post_types;
    1416                add_action( 'template_redirect', array( $this, 'load_filters' ) );
     17
     18                $this->header_text = empty( $header_text ) ? __( 'Topics', 'wporg' ) : $header_text;
    1519        }
    1620
    1721        function load_filters() {
     
    4145                        $contents_header = 'h' . $items[0][2]; // Duplicate the first <h#> tag in the document.
    4246                        $toc .= $this->styles;
    4347                        $toc .= '<div class="table-of-contents">';
    44                         $toc .= "<$contents_header>" . __( 'Topics', 'wporg' ) . "</$contents_header><ul class=\"items\">";
     48                        $toc .= "<$contents_header>" .$this->header_text . "</$contents_header><ul class=\"items\">";
    4549                        $last_item = false;
    4650                        foreach ( $items as $item ) {
    4751                                if ( $last_item ) {