• Resolved snippet24

    (@snippet24)


    So there are some filters but I’m not sure how to do this so that scripts and styles of the plugin are only loaded in the pages they are used.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WPJoli

    (@wpjoli)

    Hi there,

    By default, styles and scripts are only loaded when the TOC is present on the page.

    Did you notice the styles/scripts loading on a page that does not contain the TOC ?

    If yes, I’ll look into it.

    For manually disabling styles / scripts you can have a look a the doc here and there:

    You could then add a condition within the function to make sure the styles will not load on a specific post ID for example.

    Thread Starter snippet24

    (@snippet24)

    Hi!

    Did you notice the styles/scripts loading on a page that does not contain the TOC ? If yes, I’ll look into it.

    Yes, for example here in home page https://www.otzerling.com there’s no Table of Contents, but is still loading the plugin styles:

    https://drive.google.com/file/d/1I2LyqNTr2yps9Ciave_O2bJ447U3icg8/view?usp=sharing

    I did some further tests and the JS script works jst fine I, is the CSS that is being loaded on all pages.

    You could then add a condition within the function to make sure the styles will not load on a specific post ID for example.

    Thank you so much!

    Kind Regards

    Plugin Author WPJoli

    (@wpjoli)

    Hey !

    Sorry for the long wait, and thank you for providing useful details.

    By any chance, do you have the widget support option activated ? This could explain why.

    If not I’ll have to dive deeper into this.

    Thread Starter snippet24

    (@snippet24)

    By any chance, do you have the widget support option activated ?

    Hi yes it is enabled, and sorry somehow I missed you reply notification ??

    Plugin Author WPJoli

    (@wpjoli)

    Thank you.

    It turns out the widget support option forces the loading of the styles/scripts because the widgets do not directly interract with the actual content. That’s why.

    If you want to fine tune the loading, I suggest you use the hooks I mentioned above and create your own rules based on page types or page IDs or anything that works for you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.