[Resolved] Adding WordPress Shortcode

Home Forums Support [Resolved] Adding WordPress Shortcode

Home Forums Support Adding WordPress Shortcode

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #656143
    Alfredo

    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.

    #656302
    Tom
    Lead Developer
    Lead Developer

    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?

    #656303
    Alfredo

    thanks for the reply. Working al ready. Stupid code mistake.

    Thanks!

    #656304
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.