Welcome to Pahamify Web Documentation, in this page, you can learn about the difference between component & template with respective index with the example and how to implement it. So Please Read it with Passion ^.^
Template in our website means, a layout that we can use to generate another component so it easier to make a component with the same layout design. Not only that, there is a lot usage of template such as using template for fixated static content, Post default page (usually we use for category based condition), and component section layout template (usually we make it as component wrapper section) so it make us easier to make another wrapper component with the same layout. In template we can include logic component for specific template using HTML block. So in another word, Template can include more than one component meanwhile component better include only one component or only its component for better structure. Example of template such as:
Different from Template, Component better focus only one component for itself. Component can be imagine as atomic. For developing component we must have 2 kind of mindset “is this component for view only?” or “is this component targeted for other division purpose?“. If the component you make for view only then you can make it as best possible that you think but if it for the last one, then you must think how to make component as easy as possible for other division to change it by themselves alas, you want to help them change it every time there is a request and of course it can distract your focus right? In component you can input general logic in the component and specific logic in the wrapper template. while giving id for styling or class please remember that you must make it as detail as possible so it will not inflict another class in different component (for this, we still think how the best way to implement id and class styling, so it might change) and be sure if using script for some interactive function using document.getElementById(); or document.getElementsByClassName(); or another way with the same logic as these 2 example, you must make the id or class as specific as possible so it will not collision with other class in another component when using 2 component or more in template wrapper or you can put interactive logic such as this in the template section wrapper. Example of component such as:
When we talk about the difference of usage between template and component in our elementor website, it can be dubious sometimes since the usage is quite similiar. In simpler way, let we differentiate Template as a place you can put more than one Component or more and not only that, in template you can make a specific post page Component too, such as: Blog post, Career post, or TCM post. Meanwhile in component we can make a specific component based on display condition too, but when this documentation written (10 Nov 2021) we still not implement it. So to standardized the usage between this two feature, let we put it like this:
Template:
Component:
After we try to differentiate the both of them, their have a simmilarity usefull feature and that is Shortcode. Maybe you will ask what is shortcode? In easier way, shortcode is a Code that can render your template or component with the same content as its in. in Example if you have a template or component that contain word “Cat is Kawaii” then if you use short code it will render the same word as in the template.
Meanwhile, it is different if you import it directly, you can change the feature you give inside your page, so you can change the word “Cat is Kawaii” to another word based on content you need in the respective page. so To make it simple, Use Shortcode if you want the content the same as it is or one component with the same content for more than one page, and use import if you want to get only the layout but still can edit the content for respective page you need it.
For naming component you can use this format: [shortcode] ComponentName
ex: [16292] Package Item Diamond – Paket 5 Diamond
For naming template you can use this format: [shortcode] TemplateName Template
ex: [16653] Teacher Profile Page Template
To get the shortcode for a new component, you can create component/template without shortcode first, after template created then you will get the shortcode/template id on the list Saved Template [see img below]. Then you can edit your component/template name with shorcode id. The reason why we include shorcode id in the component/template name is for better search, currently on wordpress we cant search component by the id, we only can search the component by the Title/Component name.
Default on Elementor, we cant add inner section inside inner section (maybe for performance reason). but sometimes we need to divide column inside inner section for the layouting. Here’s step by step how to add inner section inside inner section:
if page have more than one element with same style (ex. button element), you can copy paste the element (not create from scratch) for fast delevopment. But if you copy paste element on elementor, the id of that element is not copied, we must add manually the id. So always check if element have an id or not before copying. Same condition if we duplicate (right click > duplicate) the element.
note: you can also copy paste element from different pages.
We can use a template in elementor with shortcode element, so we dont have to create element/section from scratch if the element exist in multiple pages. We can create one template and include it on several pages. Here’s how we use template with shortcode:
Pahamify Web Team