How to create one template for all WordPress posts with Elementor PRO

 
Cómo crear una plantilla para todos los post de WordPress con Elementor PRO

Steps to create a post template with Elementor

I decided to write this after having a hard time to do what is announced in the title, mostly because I hadn't used Elementor for a long time and because Builders, as intuitive as they pretend to be, are not like riding a bike.

Also, I upgraded to PRO not so long ago.

So, as I had to search and fiddle around for a while until I found what I was looking for, I leave here the process in case it's useful for someone who is in the same situation.

The mission is to make an improved template from your current template with Elementor and then apply it to all posts.

This can also be achieved with the free version of Elementor although I remember that both the way to create it and to apply it is different and much less automated.

To begin with, if you intend to make changes directly on the template, it goes without saying that you should always work on a child theme so as not to lose the changes in the updates of the template.

If you don't have it, you should create it and find out why you should have it. The "child theme" can be done manually or with a plugin. About this you have information to bore you.

In my case I made the template on the one from GeneratePress PRO which, by the way, is a great combination with Elementor PRO although the process is the same for any other template.

Here are the steps.

Option 1

The first step is the usual one for a template. Open your preferred editor, such as bootstrap and type:

<?php
/*
* Template Name: Mi-plantilla
* Template Post Type: post
*/
get_header(); ?>
>
		<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
			<?php
			/**
			 * generate_before_main_content hook.
			 *
			 * @since 0.1
			 */
			do_action( 'generate_before_main_content' );
			if ( generate_has_default_loop() ) {
				while ( have_posts() ) :
					the_post();
					generate_do_template_part( 'single' );
				endwhile;
			}
			/**
			 * generate_after_main_content hook.
			 *
			 * @since 0.1
			 */
			do_action( 'generate_after_main_content' );
			?>
		</main>
	<?php
	/**
	 * generate_after_primary_content_area hook.
	 *
	 * @since 2.0
	 */
	do_action( 'generate_after_primary_content_area' );
	generate_construct_sidebars();
	get_footer();
					
				

Now copy everything after get_header(); ?> into the single.php page of your current template.

Then paste everything you just copied just below get_header(); ?> into your new file and save it inside your child theme's folder with the extension .php and any name you want. Choose a name that lets you remember that it's your new template, such as my-template.php

The thing is like this.

From here there are two possible ways, one is to create a new post and apply "My-template" in Input Attributes to start setting up the thing

How to create one template for all WordPress posts with Elementor PRO

Then just save your work as a template, in which case you can skip the steps up to"To Layout" or take the second, perhaps less confusing path, which is the one described below.

Option 2

From the "Templates" menu select Add new.

How to create one template for all WordPress posts with Elementor PRO

On the next screen we choose Single Post. We give it the name we want and click on CREATE TEMPLATE.

How to create one template for all WordPress posts with Elementor PRO

The next screen will show us the library of available templates.

How to create one template for all WordPress posts with Elementor PRO

We close this library window without selecting anything (unless you want to start layout with one of those designs) and we will see the following (with the look of your template).

Normally you will already see the header with the header, the menus and the footer.

To layout

How to create one template for all WordPress posts with Elementor PRO

Click on the red circle with the + symbol and the following box will appear to choose the structure of your post page.

How to create one template for all WordPress posts with Elementor PRO

Here the choice is simple. If your blog's post pages have a sidebar on the right, left, both or neither, choose the option that matches.

In any case, if you intend to exactly replicate the layout of the elements of your current post pages, this structure must match. Undoing what you have done to add spaces later on would necessarily involve deleting cells and widgets and starting from scratch from the step of choosing structure.

In my case, as in my template I use a sidebar on the right, I choose this oneHow to create one template for all WordPress posts with Elementor PRO

Remember that if one day you decide to change the sidebar from right to left or remove it, you will have to create a new post template with that new structure because now Elementor is the one that rules in this option.

Widget Tetris

Now it's time to put everything in its place, we add the sidebar and we start working on the widget layout of the things that will be shown.

How to create one template for all WordPress posts with Elementor PRO

In general options

How to create one template for all WordPress posts with Elementor PRO

Among the thousand things that can be configured it is also possible to select any entry as a preview. This way it is possible to see the changes refreshing in real time on a specific content.

How to create one template for all WordPress posts with Elementor PRO

Publishing

Once we have finished, checked that in general settings we have everything we need, that the site looks the way we want it to appear and we have made the necessary previews we can save it or publish it. If we choose to publish it, you can make it apply to all entries. Or you can choose to test it on a single old post if you don't want to risk your visitors encountering any unexpected errors.

How to create one template for all WordPress posts with Elementor PRO
How to create one template for all WordPress posts with Elementor PRO

The same process works for creating post templates and page templates of different types. Don't be afraid to make a mistake, to revert all the changes back to your default template just go back to this configuration and delete the condition and everything will return to the state it was in before you applied the template.

How to create one template for all WordPress posts with Elementor PRO


Suscríbete por email para recibir las viñetas y los artículos completos y sin publicidad

Artículos relacionados

Este blog se aloja en LucusHost

LucusHost, el mejor hosting