Ticket #1802: 1802_handbook.diff
File 1802_handbook.diff, 1.2 KB (added by , 8 years ago) |
---|
-
inc/table-of-contents.php
9 9 10 10 protected $styles = '<style> .toc-jump { text-align: right; font-size: 12px; } .page .toc-heading { margin-top: -50px; padding-top: 50px !important; }</style>'; 11 11 12 function __construct( $post_types ) { 12 protected $header_text; 13 14 function __construct( $post_types, $header_text = '' ) { 13 15 $this->post_types = (array) $post_types; 14 16 add_action( 'template_redirect', array( $this, 'load_filters' ) ); 17 18 $this->header_text = empty( $header_text ) ? __( 'Topics', 'wporg' ) : $header_text; 15 19 } 16 20 17 21 function load_filters() { … … 41 45 $contents_header = 'h' . $items[0][2]; // Duplicate the first <h#> tag in the document. 42 46 $toc .= $this->styles; 43 47 $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\">"; 45 49 $last_item = false; 46 50 foreach ( $items as $item ) { 47 51 if ( $last_item ) {