Archived topic
Add Shortcode in content before comments
13 replies · Started by Pascual on February 28, 2022
Hello:
I have created a shortcode, I have put the programming in the functions.php file of our child theme.
I have placed the shortcode in a widget and it works.
Now I want to put it before the comments.
I have created a new element in elements, I have told it to put it before the comments and it does not appear.
How can I make it appear?
Thanks,
Pascual
Hi there,
which Hook did you choose in your Element?
You can see the main ones here:
Hello:
I want to put the Shortcode before the comment form
how can it be done?
In the information that you give me, the way to enter shortcodes does not appear, although in elements the option "enable shortcodes" appears
How should it be done?
Thanks,
Pascual
Hi Pascual,
Try generate_before_comments hook.
Let me know if this helps :)
Hello:
I have already put the shortcode in generate_before_comments hook,
But it does not appear.
Is it possible to send you a screenshot so you can see it?
If you go to the page:
https://leyderecho.org/caracteristicas-del-federalismo/
You will see that the Google Scholar shortcode appears in the end of footer
But before the comments it does not appear
Are you using a hook element?
If so did you check to execute shortcodes?
https://docs.generatepress.com/article/hooks-element-overview/#settings
Leo:
Yes, I have activated execute shortcode
Look at this screenshot of how I have it
https://leyderecho.org/test/hook.png
Thanks,
Pascual
Hi there,
does the shortcode work if you add it to your post content via the post editor ?
David:
It works.
I have put it in a footer widget and it appears at the bottom of the page
poe example in:
https://leyderecho.org/grupos-de-interes/
-------------
Busque Contenido Académico Relacionado con Grupos de Interés en Google Scholar
Grupos de Interés
--------------
Thanks
Pascual.
What's the location you set for the generate_before_comments hook?
Is the shortcode added to the Países widget?
Ying:
I do not understand your question.
The shortcode [google-scholar] is generated in functions.php
Where is the Countries widget?
What does it have to do?
How to configure the location of the hook?
I have put the shortcode in the text field of the hook and I have activated execute shortcode
See this screenhot:
https://leyderecho.org/test/hook.png
Pascual
In your Hook Element - what Display Rules have you set ?
Now it works
Thanks,
Pascual
Glad to hear that