0

I'm using WP for a business site (not a blog) with landing pages. So there are no posts, only pages (actually, "landing pages") which I create with the Elementor page builder.

Since a typical theme has lots of unnecessary stuff for a landing page business site, I decided to create a lightweiht custom theme. I have a header.php, footer.php and basic css/js enqueued via functions.php. I want to create each page's content using a page builder.

I don't know what to put in index.php. This is something typical:

<?php get_header(); ?>

// ....the wp loop goes here

<?php get_footer(); ?>

Of course in my case there is no loop - but that is where the main content goes. When I create a new page with Elementor (or other page builder, or Gutenberg), I want my custom per-page content to go in there, where the loop usually goes.

What markup do I place there, so the page builder knows where to insert each page's content?

1 Answer 1

2

in your theme folder. create a new php file.

For example call it: landingpage.php

in the php file you could have something as basic as:

<?php
/*
Template Name: Landing Page
*/
get_header();

while ( have_posts() ) : the_post();

 the_content();

endwhile;   

get_footer();

?>

Elementor will be called / inserted where it says the_content();

Included out of the box with elementor you should have a blank elementor template to choose from and using the built in elementor theme builder options create exactly what you are after also choosing conditions of when that page template gets used?

9
  • 1
    LOL the first thing I did was remove the loop, but I guess I really need it after all! Thanks!
    – lonix
    Commented Dec 7, 2019 at 12:55
  • Not a problem. Please see my edited part about elementor having a built in theme builder with a blank canvas option. Not sure if that is also an option for you but that depends on your theme.
    – Elgoots
    Commented Dec 7, 2019 at 12:56
  • Yeah I know, but I decided to create a custom theme anyway, because the average theme comes with LOTS of stuff I don't need, including js, css, fonts, emojis, ...... etc! So I want to use a very very simple theme (just jquery and bootstrap) and elementor. Thanks for showing me the way!
    – lonix
    Commented Dec 7, 2019 at 12:57
  • One more thing, why use landingpage.php instead of index.php? Why do you recommend doing it that way? (All pages on the site are landing pages) Is there a benefit from splitting it up like that?
    – lonix
    Commented Dec 7, 2019 at 12:59
  • index.php is not really used. it is only used to stop directory browsing from memory. page.php is actually the default index.php for pages
    – Elgoots
    Commented Dec 7, 2019 at 13:00

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.