• Resolved gatespace

    (@gatespace)


    If the permalink settings are numerically based, the table of contents link in a paginated post is incorrect.

    example.
    https://www.sample.com/archives/123

    output

    <ul class="ez-toc-list ez-toc-list-level-1">
    <li class="ez-toc-page-2 ez-toc-heading-level-2"><a class="ez-toc-link ez-toc-heading-1" href="https://www.sample.com/archives/1232/#id" title="sec">sec</a></li>
    </ul>

    Applicable parts of the source code
    https://github.com/shazahm1/Easy-Table-of-Contents/blob/master/includes/class.post.php#L1338-L1354

    Output with trailingslashit().

    	private function createTOCItemURL( $id, $page ) {
    
    		$current_post = $this->post->ID === $this->queriedObjectID;
    		$current_page = $this->getCurrentPage();
    
    		if ( $page === $current_page && $current_post ) {
    
    			return '#' . $id;
    
    		} elseif ( 1 === $page ) {
    
    			return trailingslashit( $this->permalink ) . '#' . $id;
    
    		}
    
    		return trailingslashit( $this->permalink ) . $page . '/#' . $id;
    	}
    

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘The link in the table of contents of a paginated post is incorrect’ is closed to new replies.