• Resolved mawi022

    (@mawi022)


    Hello,

    I would like to use two TOC in one post: one TOC within the post content and one within a recipe (recipe plugin).

    Will this lead to any technical problems when there are two TOC within a same post?

    Thank you and kind regards.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author LuckyWP

    (@theluckywp)

    Hello!
    Table of Contents generated on hook the_content on single post. You can add two ToC, but content in them will be equal.

    Thread Starter mawi022

    (@mawi022)

    Hello,

    thank you for your fast response.

    That’s strange, because I tried that and they do show 2 different contents when excluding/skipping certain headings, only the layout like background color etc. will overwrite the first TOC.

    What do you think?

    Thank you and best regards.

    Plugin Author LuckyWP

    (@theluckywp)

    Oh, yes. If you set for each of Table of Contents skip headings — this is will be work.

    Thread Starter mawi022

    (@mawi022)

    Great, thank you.

    Just one question: Do you have an estimated time for “Jumping back to contents”?

    Cheers!

    Plugin Author LuckyWP

    (@theluckywp)

    ETA for this feature is still unknown ??

    Thread Starter mawi022

    (@mawi022)

    Okay, thank you for letting me know.

    Do you think I meanwhile can realize the “Jumping back to contents” by giving “Contents” an ID like <p id="contents">Contents</p> and then using e.g. <a href="#contents">Back to Contents</a> for jumping back?

    Thank you and best regards.

    Thread Starter mawi022

    (@mawi022)

    Hello, any update on my suggestion of my last reply? Thank you and kind regards.

    Plugin Author LuckyWP

    (@theluckywp)

    Yes, you can do this.

    For example, add ID before TOC:

    add_filter('lwptoc_before', function ($before) {
        return '<a id="toc"></a>' . $before;
    });

    and use links:

    <a href="#toc">Back to Contents</a>

    Thread Starter mawi022

    (@mawi022)

    Hi,

    awesome, this is working properly.

    Except: How can I set the scroll distance at the top now? Because when clicking on the “Back to Contents” link, it scrolls up somewhere below the heading “Table of Contents” and not directly to it. The setting in px in your plugin settings does not do it, because this only works when jumping directly from the TOC box to a heading.

    Thank you for your kind support in this matter. Really do appreciate that.

    Plugin Author LuckyWP

    (@theluckywp)

    Try use this:

    add_filter('lwptoc_before', function ($before) {
        return '<a id="toc" style="position:relative;top:-24px;"></a>' . $before;
    });

    And configure property “top”.

    Thread Starter mawi022

    (@mawi022)

    Hi,

    that’s working awesome. Thank you so much for your kind help. You can close the thread now.

    Have a great day!

    Plugin Author LuckyWP

    (@theluckywp)

    Thread Starter mawi022

    (@mawi022)

    Just rated your plugin ?? ! Thanks for all your help!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Will two TOC within one post lead to problems?’ is closed to new replies.