Problem:
How can I integrate Layouts in my theme without destroying the Theme's native Loop?
Solution:
Integrating Layouts to your Theme the way elaborated in the DOC below, will remove the Theme's Loop and let you customise the Theme with Layouts ONLY.
You will not be able to view the customised Template anymore with your Theme's Loop.
An Agile approach is to wrap the Theme's Loop in a conditional and call Layouts only if desired.
This will allow you to use EITHER Layouts OR your theme's Loop.
The Function that does this looks like this:
//If Layouts is active and an Layout is assigned to a Post Type (rendered by this template), use Layouts if ( defined( 'WPDDL_VERSION' ) && is_ddlayout_assigned() ) { get_header( 'layouts' ); //Optional call to a header-layouts.php template the_ddlayout( 'page-default' ); // Loads the 'page-default' layout by default(can be empty) get_footer( 'layouts' ); //Optional call to a footer-layouts.php template } // if not, use the normal WP/Theme loop else { //Here goes your Current Theme's Loop }; // If Layouts are enabled (close the IF)
Relevant Documentation:
https://toolset.com/documentation/user-guides/layouts-theme-integration/
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | - | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 |
- | - | - | - | - | - | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
This topic contains 2 replies, has 2 voices.
Last updated by FedericoI4663 7 years, 10 months ago.
Assisted by: Beda.