Support » Plugin: Elementor Page Builder » Add code to Elementor page?

  • Does anyone know of a way to add code to an Elementor page? I am trying to display a Query String and everywhere says to do it in php but Elementor doesn’t like php. None of the plug ins are working. I see the HTML option but I don’t think I can grab the variable value and then display it with HTML.

Viewing 5 replies - 1 through 5 (of 5 total)
  • pingram

    (@pingram3541)

    It’s not the best choice to execute server-side code this way and that is why it is not allowed.

    Fred, it’s not Elementor but WordPress core that does that because it was never designed for code but to auto-format blog content for writers.

    Use your favorite code editor or download AceIDE plugin to give you a full code editor in the back end of WordPress and use Elementor Hooks to add custom PHP. For example, add your code in your theme’s functions.php (preferably child-theme if it’s not your own custom theme).

    Choose the best hook to execute your custom php – https://code.elementor.com/php-hooks/

    As for javascript, I’ll often use the html element to add script tags and then execute my code from an anonymous function. Javascript can indeed capture query strings from the url via window.location and then you can parse the key value pairs…

    https://stackoverflow.com/questions/2090551/parse-query-string-in-javascript#2091331

    Cheers!

    The concept of PHP is server side execution and a result returned to client.
    You are trying to start on the client and feed the server things the client should not have access to (parameters of server side code)
    @pingram3541 is suggesting that if your doing business in the client to keep the business in the client IE javascript.

    A clients source code should never reveal how a PHP function works.

    Now if you want to use a action=post”customphp.php” on your form submit you can simply install a form redirect plug in and instead of telling it to go to thankyou.html tell it to go to your customphp.php and have it then return data to your following page.

    Rule of thumb is do not mix your business logic. Do it server ( php ) or client Javascript. WP is designed to allow client business logic.

    As a newbie to webdesign and WP, it is possible that my question/comment was answered but I didn’t understand it.

    I was provided HTML code that I want to add to either my footer or a specific page (not sure yet) and have no idea how to do that. In WP, when I click on the button “Back to WordPress Editor” I get a warning that I could break the layout, design, and content of my page.

    If you can let me know in “newbie” language how to proceed I would be thankful!

    Same issue. Looking to add Zoho tracking code. All I see is elementor and no way to edit html.

    hhcw- There is an HTML widget box that can be added to your page or post. Code can be put in that. As to going back and forth between WP editor and Elementor Editor, Don’t Do That. Once you take a page you should not try to modify it in WP. This will cause multiple issues.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add code to Elementor page?’ is closed to new replies.