• Resolved jiggaman

    (@jiggaman)


    Really impressed by your plugin and started using it.

    Couple notes:

    1. Is it possible to make it have a transparent background if needed option
    2. Some of my posts have numbers in the headings, ie

    <h2>1. Something</h2>
    <p>Blah blah</p>
    <h2>2. Something</h2>
    <p>Blah blah</p>

    When your plugin makes the TOC, the result will be:
    1. 1. Something
    2. 2. Something

    It seems like it would be possible to detect for this automatically, is there an option for that I am missing?

    Perhaps if it saw the pattern of the heading starting with “SEQUENTIAL NUMBER” followed by “space” or “.” or “:” or “-” then it would know to do something to not show repeated numbers in the table of contents.

    Thoughts?

    Thanks!

    • This topic was modified 5 years, 1 month ago by jiggaman.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter jiggaman

    (@jiggaman)

    <bump>

    Plugin Author LuckyWP

    (@theluckywp)

    Hello! Sorry for long answer…

    1. Is it possible to make it have a transparent background if needed option

    You can use transparent color scheme here: https://ps.w.org/luckywp-table-of-contents/assets/screenshot-8.png?rev=2099146
    or change background by CSS.

    2. Some of my posts have numbers in the headings,

    You can set individual settings for each post. And for posts with numbers disable numeration in table of contents.

    Thread Starter jiggaman

    (@jiggaman)

    Right…but trying to figure out something that doesn’t require going into ever post..say 50% have numbers, 50% don’t out of a 500 posts.

    Your plugin BEAUTIFULLY works for automating the process of the table of contents without me having to check every post and accidentally missing one.

    So perhaps the important requested feature would be the following:

    Here would be a good place for you to start:
    https://stackoverflow.com/questions/12001037/regex-for-validating-only-numbers-and-dots/12001377

    But you could take it further to include other patterns.

    I’m sure this is a common situation, and addressing this in an automated way would really add a lot to your already great plugin!

    Plugin Author LuckyWP

    (@theluckywp)

    I think in next version we will add new hook filter for modify headings in table of contents and you will be able to implement a function to remove the numbering.

    Thread Starter jiggaman

    (@jiggaman)

    ok, just heads up i modified

    front/views/items.php and added
    <?PHP $item['label'] = preg_replace("/^\d+\. |(?:\d+\.)?\d+$/", "", $item['label']); ?>

    seems to work well for now

    Plugin Author LuckyWP

    (@theluckywp)

    This is also a solution ??

    I recommend place file items.php to folder luckywp-table-of-contents in your theme. This will allow you to save your edits when updating the plugin.

    Plugin Author LuckyWP

    (@theluckywp)

    Hello @jiggaman !
    We released version 2.0.9 with filter lwptoc_heading_label. Try use him.

    Thread Starter jiggaman

    (@jiggaman)

    just created it in my theme for the update, works great, thanks!

    Plugin Author LuckyWP

    (@theluckywp)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Possible to detect for numbers and not double heading numbers?’ is closed to new replies.