Archived topic
Adding Wordpress Shortcode
3 replies · Started by Alfredo on August 21, 2018
Hi there!
I am trying to create a shortcode to display the content of some custom post. I am trying the basic wordpress example, however, nothing displays on the frontpage after using this code and adding to the editor '[foovar]'
function foobar_func( $atts ){
return "foo and bar";
}
add_shortcode( 'foobar', 'foobar_func' );
The page has selected the predetermine template.
If i add the shortcode in a page created with elementor,it works and it prints "foo an bar".
Does GP handle shortcodes differently?
Thanks.
Hi there,
Shortcodes within the content are handled by WordPress itself - not the theme.
So when you put the [foobar] shortcode into your page content, it doesn't return? Does other content return on this page?
thanks for the reply. Working al ready. Stupid code mistake.
Thanks!
No problem! :)