Skip Navigation

[Resolved] Add a DIV around entire layout?

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to wrap an entire Layout output in a custom

<div></div>

tag.

Solution:
This is not possible directly from the UI of Layouts Plugin.

Let's see an example on

page.php

of our Starter Theme "Toolset Starter"
https://toolset.com/account/downloads/#example-themes

In

page.php

you have currently this:

if ( defined( 'WPDDL_VERSION' ) ) :
    get_header( 'layouts', 'page-default');
        toolset_assigned_message('layout-page', 'page-default');
        the_ddlayout( 'page-default' ); // Loads 'page-default' layout by default
    get_footer( 'layouts' );
else:// more code follows

If you now wrap the

the_ddlayout( 'page-default' )

into your "div" tag, it will also render as such in the Front End (entire layout wrapped in a custom "div")

EXAMPLE:

<div class="wrap">
<?php
the_ddlayout( 'page-default' ); // Loads 'page-default' layout by default
?>
</div>
This support ticket is created 8 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

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 Evan Seplow 7 years, 6 months ago.

Assigned support staff: Beda.

Author
Posts
#306651

I have a complex layout and now need to add a jquery scrolling function. This function requires a DIV Class to be a wrap for the entire page.

I tried using the Body (and it's classes), since it would seem to be the perfect option - but for this purpose Body has it's own set of complications...

So I'd like to take the entire page and make it like:

body
- <div class="wrap">
-- Entire Layout
-</div> (close "wrap")
</body>

Can you suggest any ways I can achieve this?

#306692

Thank you for contacting us here in the Support Forum

This is not possible directly form the UI of Layouts Plugin.

But you can edit your php files where you insert the layout.

Let's see at a example in page.php of our Starter Theme "Toolset Starter"
https://toolset.com/account/downloads/#example-themes

In page.php you have currently this:

if ( defined( 'WPDDL_VERSION' ) ) :
	get_header( 'layouts', 'page-default');
		toolset_assigned_message('layout-page', 'page-default');
		the_ddlayout( 'page-default' ); // Loads 'page-default' layout by default
	get_footer( 'layouts' );
else:// more code follows

If you now wrap the

the_ddlayout( 'page-default' )

into your div class="wrap", it will also render as such in the Front End (entire layout wrapped in a div)

As example:

<?php
if ( defined( 'WPDDL_VERSION' ) ) :
    get_header( 'layouts', 'page-default');
        toolset_assigned_message('layout-page', 'page-default');
?>
<div class="wrap">
<?php//reopen PHP
the_ddlayout( 'page-default' ); // Loads 'page-default' layout by default
?><--close PHP
</div>
//further code to follow

Please let me know if you have further questions regarding the issue mentioned in this Thread
and let me know if the above solution works for you, I look forward to your reply!

Thank you

#309448

Thank you Beda - We wound up going with a Jquery solution but I'm sure to use this next round. Appreciated!