nivianh / toc

Plugin allows you to insert a table of contents into your posts, pages and custom post types.
10 stars 4 forks source link

Issue with <!--ToC--> Not Rendering in Content #8

Closed Fledardev closed 1 week ago

Fledardev commented 1 week ago

Hi @nivianh,

I've encountered an issue when trying to manually insert the Table of Contents (ToC) using the tag in the content of my page. Despite inserting the tag at the desired location, the ToC does not appear at that position, and there is no ToC displayed in the content.

$this->theTag = '<!--ToC-->'; $customToCPosition = strpos($content, $this->theTag);

Steps to Reproduce:

  1. Insert in the body of a page or article.
  2. Save and view the page.
  3. Notice that the ToC does not render where the tag was placed.

Expected Behavior: The Table of Contents should appear at the exact position of the tag in the page content.

Actual Behavior: The ToC does not render at all when using the tag.

Could you please investigate this issue and provide a fix? It seems the plugin is not recognizing the manual insertion tag. Idea : how to activate $customToCPosition ?

Thanks!

nivianh commented 1 week ago

@Fledardev

use <div><!--ToC--></div>

Fledardev commented 1 week ago

@Fledardev

use <div><!--ToC--></div>

Not working, respect only the position defined in the settings

nivianh commented 1 week ago

@Fledardev use <div><!--ToC--></div>

Not working, respect only the position defined in the settings

@Fledardev can record video or take screenshot?

Fledardev commented 1 week ago

@Fledardev use <div><!--ToC--></div>

Not working, respect only the position defined in the settings

@Fledardev can record video or take screenshot?

@nivianh, this is the link : https://we.tl/t-IWHvL4jUgN

nivianh commented 1 week ago

@Fledardev No! add to Content editor in post/page

Screenshot 2024-09-11 at 13 38 35
Fledardev commented 1 week ago

It works, thank you. But not ideal because not possible to use <div><!--ToC--></div> in widget area.