Archived topic
Do Shortcode in 404 Template
3 replies · Started by Sebastian on January 21, 2018
Viewing posts 1–4 of 4
Hellö!
So I'm using the code to alter the display on the 404 page and want to load a gravityforms form there. So I would think the code should look something like this, but since it's not a post or page the shortcode won't just render the form like that.
So what do I need to add to have the shortcode rendered, please?
add_filter( 'generate_404_text','generate_custom_404_text' );
function generate_custom_404_text()
{
return '[gravityform id="3" title="false" description="false"]';
}
Hi there,
Try this:
add_filter( 'generate_404_text', 'tu_custom_404_text' );
function tu_custom_404_text() {
return do_shortcode( '[gravityform id="3" title="false" description="false"]' );
}
aaaaand it works. :)
thank you so much.
You're welcome :)
This archived topic is closed to new replies.