• Resolved Pascalvd

    (@pascalvd)


    Hi,

    I was wondering if it is possible to automatically insert the ToC after/before an element with a certain class. I’m familiar with PHP and JavaScript so no issues with writing some code. Is this possible via hooks? Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Steven

    (@shazahm1hotmailcom)

    There is not a filter that can be hooked into. Here’s the section of the code which does the insert.

    I’m open to adding a filter if you have a recommendation.

    Thread Starter Pascalvd

    (@pascalvd)

    Hi Steven,

    Thanks for your reply. The problem is that I’m also dynamically inserting ads within the content, which are also being inserted before the first heading (just like the ToC). However, I want the ad to appear below the ToC, but instead it was being inserted before the ToC.

    I was thinking of adding a functionality so people can enter a class name and indicate if the ToC should be inserted before or after the element with that specific class. In my case that would be the class I have assigned to my ad container.

    However, this functionality is no longer needed by me, because I figured I could achieve what I wanted by adjusting the priority of my ad insertion filter. I’m not sure if this feature is something other people would be interested in.

    Anyway, thanks for the reply once again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Insert after/before element with specific class’ is closed to new replies.