Search the Community
Showing results for tags 'table of contents'.
Found 1 result
-
I don't know whether this is the right place for the topic but because it is related to the design of the website, so I thought to put it here. I am trying create the table of contents on every page of my website separately. I use exclusively H2 tags for the important headlines so the table of conents only needs to read the h2 tags. First of all, I don't know how to create it as I am not good at scripting languages. This means that I will have to use a script created by someone else. Secondly, I am having trouble to decide what script to use. Should I use PHP or Javascript. I would personally prefer PHP as I don't need the script to be responsive to user actions or anything like this, but I would still like to hear from experts. I just know the basics of both php and javascript. Only enough to help me gues the structure of my wordpress website and to understand where and how I need to edit the code if I am to remove or add something. I cannot create my own php applications or javascripts. What I need from the function would be: 1. First of all, the script should read all the h2 tags of the page and store them into an array. 2. The script should add a local link (I don't know what it is correctly known as, but I mean the "go to top" type of link) near each h2 tag. 3. The script should convert each element of the h2 tags array to a link that points to the specific local target of the page. So where can I find such script and should I use PHP or Javascript. By the way, If you need some idea about my website's structure, here's the link: MANanatomy