Archived topic
Dynamic Content in Block Element
1 reply · Started by Matt on November 22, 2020
Hi,
I have created a custom pre-footer with the Blocks element and used the generate_before_footer hook to register it above the main footer. I have a couple of shortcodes in my child functions.php to display content per page from the default wp metaboxes.
The shortcodes are able to fetch the correct content, but it is not being rendered within the container that is calling the shortcodes.
The shortcode markup looks like this "Item No.: [footer_code] Date of preparation: [footer_date]" and the code is being rendered in between the body content and my custom pre-footer like this:
<div id="page" class="site grid-container container hfeed">
CODE-0123456October 2020
<div class="gb-container gb-container-9ae5c626"><div class="gb-inside-container"> <- This i my custom pre-footer element
Any ideas? Thanks
Hi there,
that will be related to how the Shortcodes are outputting their content.
Are the shortcodes a custom function ? If so - check the example here:
https://docs.generatepress.com/article/creating-a-shortcode/
This uses Output buffering which will return the content to the buffer before outputting it to the page which will keep it in place.