Your Cart

Get Amazing Offers on Scripts

Get UX Support

How to add PHP code to WordPress Elementor Page Builder using short code?

Elementor is a popular WordPress page builder that allows users to create and design web pages without needing to write custom code. While you can use Elementor to design the visual aspects of your web pages, you typically don’t add PHP code directly within the Elementor interface. PHP code is usually added to your WordPress theme files or custom plugins.

However, there are some ways you can integrate PHP functionality into Elementor:

  1. Using Shortcodes: One common way to add PHP functionality to Elementor is by creating custom shortcodes in your theme’s functions.php file. These shortcodes can encapsulate PHP logic and be used within Elementor widgets that support the use of shortcodes.

    For example, you can create a custom shortcode like this in your theme’s functions.php file:

					function custom_php_shortcode() {
    // Your PHP code here
    return "This is some PHP-generated content.";
add_shortcode('custom_php_shortcode', 'custom_php_shortcode');
  1. Then, you can add [custom_php_shortcode] within an Elementor text widget, and it will execute your PHP code when the page is loaded.

  2. Creating Custom Widgets: If you have advanced PHP functionality to add, you might consider creating custom widgets or extensions for Elementor. This requires some PHP development skills and knowledge of the Elementor API.

  3. Theme Templates: If you need to modify the overall structure or layout of your website, you can work with your WordPress theme’s templates, such as header.php, footer.php, or single.php, and add PHP code there. These templates control the structure of your website, and you can customize them to suit your needs.


Please note that directly adding PHP code to your website should be done carefully, especially if you’re not familiar with PHP programming. Improperly written PHP code can lead to errors or security vulnerabilities. Always take precautions and back up your website before making any significant changes.

Keep in mind that Elementor’s capabilities may evolve, so it’s a good idea to check the Elementor documentation and support resources for any updates or new features related to PHP integration if you are working with a more recent version.

Leave a Reply
Free Worldwide shipping

On all orders above $50

Easy 30 days returns

30 days money back guarantee

International Warranty

Offered in the country of usage

100% Secure Checkout

PayPal / MasterCard / Visa