- This topic has 16 replies, 3 voices, and was last updated 4 years, 2 months ago by
David.
-
AuthorPosts
-
January 31, 2022 at 9:07 pm #2100871
RJ
Hey there – is there a way to have my block hook appear:
1. after my feature image?
2. after my table of contents?
TIA
February 1, 2022 at 12:05 am #2100953Fernando Customer Support
Hi Robin,
Both of your inquiries should be possible. The hook you’ll be using to display your custom block under the Featured image or under the table of contents would depend on how you’re adding these two.
For instance, in my test website, I’m adding the Featured Image through the Customizer settings.
See this for reference: https://share.getcloudapp.com/o0uZXADk
Correspondingly, looking at the Hooks Visual guide (https://docs.generatepress.com/article/hooks-visual-guide/), I can simply choose after_entry_header as the Hook name and set the Priority to something higher than the default which is 10 to display my block element under the featured image: https://share.getcloudapp.com/7KuqkN06
Moreover, if you’re adding these two through Block Elements as well, you can try using the same hook name used, and then set a higher priority to push the new custom block element below.
If you’ll need further assistance regarding this, may I know how you’re adding the Featured image and the table of contents in your website so I can recommend a hook which would suit best for your preference?
Hope to hear from you soon! 🙂
February 1, 2022 at 1:48 am #2101036RJ
Hi Fernando,
Thanks for that. I’ve created a screen recording of what I have done using your suggestions. I still need to try and make the gold/red box appear under the Table of Contents, but hopefully, everything is explained in the screen recording.
Watch the screen recording here.
TIA
February 1, 2022 at 2:07 am #2101054Fernando Customer Support
I tried accessing the link to the screen recording, however, I am unable to do so.
For reference, this is what I see: https://share.getcloudapp.com/geudyDNX
Can you try sending a link of the screen recording again? Thank you! 🙂
February 1, 2022 at 3:47 am #2101136RJ
Oops, try this – https://www.screencast.com/t/iBXW26ur9
February 1, 2022 at 4:32 am #2101184David
StaffCustomer SupportHi there,
The Easy Table of Contents plugin auto inserts the table into your post content, which makes it impossible to move it between two blocks in the block element. Instead we need to add the ToC in the Block element:
1. In the ToC plugin settings disable the Auto Insert.
2. Edit the Element containing your featured image and gold box:
2.1 Add a Shortcode block above the gold box HTML.
2.2 Add the ToC plugins shortcode:[ez-toc]February 1, 2022 at 6:35 am #2101324RJ
Many thanks, David. Much appreciated. That worked. Awesome!
Robin
February 1, 2022 at 6:42 am #2101329RJ
Actually, I have just noticed that the links in the Table of Content do not work now.
See: https://www.eatweeds.co.uk/alexanders-smyrnium-olusatrum
Any ideas what to do?
February 1, 2022 at 7:09 am #2101353David
StaffCustomer SupportHmmm…. thats super weird, can you temporarily disable autoptimize ( and any other cache / optimization plugins if any )
February 1, 2022 at 7:32 am #2101382RJ
February 1, 2022 at 9:35 am #2101618David
StaffCustomer SupportSo the easy ToC shortcode no longer likes being hooked into places. Its adding the correct IDs to each of the headings but the Links it creates are incorrect. They all start with a Capital eg
#Linkinstead of#linkand hyphens are replaced by underscores…. eg,#The_linkinstead of#the-linkWhich is completely baffling and something the plugin author would need to address.
February 1, 2022 at 9:39 am #2101624RJ
OK, I’ll look into using a different plugin and get back to you.
February 1, 2022 at 9:45 am #2101634David
StaffCustomer SupportOdd one as it used to work – i wonder if the latest version of WP has messed with its workings.
I did look at alternative methods such as filtering the content to add that block in after the auto inserted ToC but that has a completely different set of problems.The one thing i could get to work was to Hook inside the ToC – but it would be inside the grey container… let me know if thats an option.
February 1, 2022 at 10:08 am #2101666RJ
Thanks, David. I’ve disabled it and installed ToC+. They say this:
If you would like to fully customise the position of the table of contents, you can use the [toc] shortcode by placing it at the desired position of your post, page or custom post type. This method allows you to generate the table of contents despite having auto insertion disabled for its content type. Please visit the help tab for further information about this shortcode.
I tried it using the method you mentioned earlier, but it didn’t work. Maybe the latest WP has broken the ability as you mentioned for lots of plugins.
ATM, the location is good enough, just not how I would really like it to look.
If you have any ideas, I am all ears. Here are the ToC+ Help files.
Cheers.
February 2, 2022 at 3:03 am #2102436David
StaffCustomer SupportI think both those plugins are built on the same code. Bit of a head scratcher. Whatever scripts its using doesn’t recognise the ToC is present on the page when added by a hook.
If you leave it in the Block Hook and also enable the Auto function in the plugin settings so there are two on the page then they both work. So not ideal but you could do that and we could hide one with CSS…. -
AuthorPosts
- You must be logged in to reply to this topic.