How to get the outline of a post?


#1

like above, I want build it for my theme


#2

As far as I understand your requirement, you want to show a “table of content” above your each post.
You can do this by using JavaScript.
The concept is, loop through your post content and get all the headings. Generate a ordered or un-ordered list of those headings and inject that above the content.

There is a good article on css-tricks you can check that. https://css-tricks.com/automatic-table-of-contents/


#3

Thank you very much !