I built a page with Elementor, and I want to use it as my home page. When I use a static home page with my theme, it still gets wrapped with the header, footer, and content container, which I don't want in this case.

I've built a simple front-page.php template to try to just output the contents of this page.

<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js no-svg">
        <meta charset="<?php bloginfo( 'charset' ); ?>">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="profile" href="http://gmpg.org/xfn/11">
        <?php wp_head(); ?>

    <body <?php body_class(); ?>>
$page = get_page_by_path( 'home' );
$content = apply_filters('the_content', $page->post_content); 
echo $content;


  <?php wp_footer(); ?>

This works to output the content, but I don't get the styles and my posts widgets are MIA. How can I modify this template to also get the styles and so that all the widgets will be present?

  • 1
    In your theme, are the styles actually enqueued through functions.php? Since you have wp_head() here they should come through if they are. If not, you should remove them from being directly added to header.php and instead enqueue, so they can also appear here. As far as widgets, it depends on where your widgetized area is. Check your other template files and see - there is probably a sidebar (even if visually it's not a sidebar, WP calls it a sidebar) which you'll need to call in order to display widgets here as well.
    – WebElaine
    Jul 5, 2018 at 15:27
  • @WebElaine I'll check where the styles are enqueue. Thanks! On the widgets, I wasn't at all clear about what I was talking about. I'm referring to an Elementor widget rather than a WordPress widget here. I have a posts list on the page using Elementor's posts widget
    – raddevon
    Jul 5, 2018 at 15:31
  • 1
    Search your theme files for style.css to figure out where it's coming from. If it's added properly you should see a call to wp_enqueue_style in functions.php. If it's just hard-coded as a <link rel="stylesheet"> somewhere, that's the problem with the styles. It's also worth inspecting the homepage itself to see whether there is any reference to the styles - it could be the stylesheet is loading but somehow you're missing a body class or something critical. Or could be the stylesheet tries to load but it's the wrong path.
    – WebElaine
    Jul 5, 2018 at 15:45
  • 1
    Sounds like you need to contact Elementor's authors to figure out the best way to meet your goals.
    – WebElaine
    Jul 5, 2018 at 17:02
  • 1
    You can change the elementor style output to be an inline in the elementor settings->advanced
    – Shibi
    Jul 5, 2018 at 18:49

2 Answers 2


Here is the way,

$contentElementor = "";

if (class_exists("\\Elementor\\Plugin")) {
    $post_ID = 124;
    $pluginElementor = \Elementor\Plugin::instance();
    $contentElementor = $pluginElementor->frontend->get_builder_content($post_ID);

echo $contentElementor;

get_builder_content is an internal method, please use get_builder_content_for_display().

$frontend = new \Elementor\Frontend();
$page_id  = 100;

echo $frontend->get_builder_content_for_display( $page_id, $with_css = true );
  • 1
    Thank you, I created a shortcode and also theme templates with this very code and works great!
    – Diana
    Dec 15, 2021 at 14:35
  • for me get_builder_content_for_display doesn't output anything but get_builder_content works fine. Aug 30, 2022 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.