• Resolved anjanphukan

    (@anjanphukan)


    Hi

    I have a Custom Post Type named – Event and they are designed using Elementor.

    Now I am creating a custom shortcode where I am using a WP Custom Query to show all the Events’ title and the contents which were designed with Elementor.

    But it looks like if I use get_the_content() function inside the shortcode then the Elementor design doesn’t show up. Instead of that it shows the contents like plain editor.

    I believe, I can’t use the_content() in the shortcode’s function.

    So is there a way to show CPT’s Elementor design in a shortcode’s custom query?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support enmanueldiaz

    (@enmanueldiaz)

    Hello,

    Thank you for reaching out to us with your query. I understand that you’re trying to create a custom shortcode that displays your Custom Post Type (CPT) ‘Event’ content, including the designs created with Elementor.

    When Elementor designs a page, it actually saves a lot of metadata that gets applied when the page is rendered. The issue you’re encountering arises because get_the_content() only pulls the raw post content from the database and doesn’t apply the additional metadata that Elementor uses for styling.

    Unfortunately, as you’ve noted, the_content() function can’t be used inside a shortcode because it directly outputs (echoes) the content, which doesn’t work properly within a shortcode’s return structure.

    The task you’re trying to accomplish is a bit complex as it falls within custom coding, and as such, it’s outside the scope of our support.

    However, I’d recommend looking into the apply_filters('the_content', get_the_content()) function which might help you achieve what you’re trying to do. This applies all filters that are usually applied to the_content(), which includes Elementor’s content filters.

    Please remember that while it’s possible to do some troubleshooting on your own, custom code might require assistance from a developer who is familiar with WordPress, Elementor, and PHP to properly implement and ensure it works well with your setup.

    I hope this helps to guide you in the right direction. If you have any further questions or if there’s anything else you need assistance with, please let me know.

    Best Regards,

    Thread Starter anjanphukan

    (@anjanphukan)

    Hi @enmanueldiaz

    Thank you so much for understanding my probleming giving me a detailed reply. I know I am asking a complex functionality. Also it is not possible now and may require some advanced custom coding.

    I already tried the apply_filters('the_content', get_the_content()) function but it didn’t work. So I consider it as impossible functionality for now. But with the hope that maybe we will have something like this in Elementor itself in the future.

    All the best and thank you so much once again.

    Regards
    Anjan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is it possible to show Elementor design in a shortcode with custom query?’ is closed to new replies.