Avada Forums Community Forum Help with custom shortcode?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • AxisMkt
    Participant
    Post count: 1

    HI all, I’ve registered a new shortcode via my functions.php file in my Avada child theme. The shortcode is a query that loops through a custom post type to output posts. That works fine and it outputs the posts fine.

    THE PROBLEM: I am calling the shortcode in a codeblock inside a container about halfway down a full-width template page. I want it to display in that container, but it displays at the top of the page (right below the header), above all of the other containers, no matter where I place it inside of fusion builder.

    Any ideas what might be causing this? Is there an issue with outputting a php query loop via a shortcode in a codeblock? Thanks for any help!!

    Michael C
    Keymaster
    Post count: 540

    Hi @AxisMkt

    It sounds like the problem is with your shortcodes. For shortcodes, they should return HTML not echo it. By the sounds of it the problem is that your shortcode is echoing HTML.

    For more details please check here – https://codex.wordpress.org/Shortcode_API
    In particular the part under the Output heading.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.