• Resolved racket8912

    (@racket8912)


    Okay so I am developing a custom child theme of OceanWP and I have custom post types that all use the same Elementor single page template which uses a loop element template to display events from an API request that involves that custom post type specifically.

    Basically, I need to self-generate the event info on the go and display it within my Elementor Loop template which is being shown within an Elementor Posts element. It works for now because each event I get from the API is being turned into another Custom Post type called Event and that event has Advanced Custom Fields that are linked to the Elementor Loop template dynamically.

    But I cannot keep creating Event custom post types for every event as there are literally tens of thousands of them and instead I just want to inject the info I get back from the API directly into my Elementor Loop template from my PHP code.

    How do I set information through my PHP code into my Elementor element? I know shortcodes exist but how would shortcodes help in my scenario since I need to inject dynamic data from code into an Elementor element on my site?

    Is what I’m even asking possible?

    • This topic was modified 6 years, 9 months ago by racket8912.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Elementor Pro has dynamic content that can be pulled from ACF easily, but if you are using the free version, you’ll need to make use of the Developers documentation and github. Custom coding would be outside the scope of the support here.

    Thread Starter racket8912

    (@racket8912)

    Hello. I have Elementor Pro and I have already set up dynamic fields using my ACFs. My issue mainly is the following: how do you base those dynamic fields to change based on the current page’s say title or ID or any identifier?

    I want to create pages that don’t have any content in them until a visitor visits the page and then an API request grabs some data and fills it into that page. If I was doing this in code I can just use a variable that ties in the current page with my Elementor posts element but without using code how can I create conditional statements on the content Elementor will show based on the Page’s Title?

    I can’t help with the conditional code, but if request parameters will help you, then this guide might be what you need: https://docs.elementor.com/article/451-dynamic-request-parameter

    Also, since you are using Pro, you’ll need to open a support ticket at my.elementor.com for any future questions. WordPress.org rules state that commercial products are not supported here.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How do you combine Elementor with my custom php code?’ is closed to new replies.