Archived topic
Associate my post to table of content in the side bar
28 replies · Started by Simone on July 7, 2020
Hi
I uploaded the table of content plus plugin and the sticky widget. How can I add a post to the widget section so I can associate the table of content to my post in the sidebar?
I hope I explained my self cleary:)
Hi there,
the Table of Contents plugin should automatically create the TOC for each post.
Simply add the plugins shortcode [TOC] to a HTML Widget in Appearance > Widgets.
Hi David,
Thanks, do you mean the widget on the right sidebar of the home page? But then it's not related to a specific post. How can I relate to a specific post and not to all of them?
That shortcode should be dynamic and will display a TOC for the specific post being viewed - is that not the case?
Not at all. When I put the code TOC in the widget sidebar on my home page, this widget appears on every post.I might do something wrong
So - do you only want this to be displayed on specific posts?
If so can you add it to a Post ( inside the post editor using a Shortcode Block ) and send me a link to where i can see it.
Yes, I want to put the code to a specific post. I send you a link to a website that uses your theme and the same plugins, but he succeeded to put the code on a specific post. I don't know how he did that.
They built it in Elementor.
We can try this:
1. Go to Appearance > Elements -> New Hook.
2. Add the toc shortcode.
3. Select before_right_sidebar_content hook
4. Check: Execute Shortcodes.
5. Set your Display Rules to the Post you want it displayed.
There is no new hook. I don't find it. Also, I didn't understand "Set your display rules to the post you want"
You need to create a new Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
Then follow those steps.
Ok, thanks. Can you tell me where to find the code of the TOC? Or I can just write TOC on the hook?
The hook just allows you to add the shortcode from TOC.
Not sure what code of TOC you are looking for but it might help with check with the plugin support on plugin-specific questions.
Hi
I found the shortcode, and I inserted it in the hook. Bit now I don't know what to do next. What should I write on the hook? https://www.screencast.com/t/0IaQ89yF9Ih
Hi
I followed exactly the same steps you sent me and it doesn't work. Please see screenshots
https://www.screencast.com/t/KC5PYhekidm
https://www.screencast.com/t/j5L8Xqabp
I also set my article on content/right sidebar and it doesn't appear.
I tried to put a picture n the side. But also doesn't work.
In your Hook Element:
1. Title field: name this whatever you want. Example: Table of Contents
2. Check: Execute Shortcodes
3. Select the Display Rules Tab - in Location select the Post ( or Page ) where you want it displayed.