Skip Navigation

[Résolu] layout integration twentyeleven theme

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created Il y a 9 années et 4 mois. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Pacific/Pago_Pago (GMT-11:00)

This topic contains 9 réponses, has 3 voix.

Last updated by paulB-10 Il y a 8 années et 8 mois.

Assisted by: Riccardo Strobbia.

Auteur
Publications
#268300
twentyeleven-child.png
ErrorMessage.png
Layout.png

I am trying to: implement layout in the twenty eleven theme
I have done the following steps.
1. created the twenty eleven-child
2. created a functions.php file.

<?php

add_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_style' );
function enqueue_parent_theme_style() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}


ddlayout_set_framework('bootstrap-2');

3. cloned the page.php file
amended it from

<?php
/**
 * Template for displaying all pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */

get_header(); ?>

		<div id="primary">
			<div id="content" role="main">

				<?php while ( have_posts() ) : the_post(); ?>

					<?php get_template_part( 'content', 'page' ); ?>

					<?php comments_template( '', true ); ?>

				<?php endwhile; // end of the loop. ?>

			</div><!-- #content -->
		</div><!-- #primary -->

<?php get_footer(); ?>

to this

<?php
/**
 * Template for displaying all pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
get_header(); ?>
 
<div id="primary" class="content-area">
  <div id="content" class="site-content" role="main">
    <?php
      the_ddlayout( 'default-layout' );
    ?>
  </div><!-- #content -->
</div><!-- #primary -->
 
<?php
get_footer(); ?>

4. I get the message
A template file that supports layouts is not available for the "Page" post type.
Please check here to see how to set one up.

While I am sure the process is quite simple and you have explained in the documentation it would be useful to give an actual example of how this is done. I am using twenty eleven as a trial for my end goal of integrating with avada theme
thanks in advance of a solution.

#268406

This should work, let me try and replicate your problems and talk to the developers.

I will get back to you with more information.

Regards
Caridad

#268476

Thanks for the update.

#268578

I was able to reproduce your problem and enquired to the developers.
I will get back to you with their feedback.

Regards
Caridad

#268618

Dear Paul,

I am in on behalf of Caridad, there is actually a problem (bug) in our template hierarchy.

Please create a page-layouts.php file and it will solve the problem immediately.

I am going to work on this and find a solution to make everything work both with page.php and page-layouts.php.

Hope this helps,
Riccardo

#268771

Dear Paul,

I took a look to how this works and made some test and there is no bug related to page template assignment.

The main problem here is the message which is misleading, since it mentioned '"[...]Page" post type', but the behaviour is correct, in fact in the Template (then Layouts) section of post edit page sidebar, you assign a template to a page (http://codex.wordpress.org/Page_Templates), meaning a file a to display page content which has this header:

/**
 * Template Name: Your Template name
 * 
 */

with or without a layout, while page.php is the default template to display page content with or without Layouts.

To use page.php in combination with a layout you cannot assign that layout from the Template selector (in fact that's not a custom template), you have 2 choices:

1. define the layout as the argument of the 'the_ddlayout' API function:

      the_ddlayout( 'page-layout', array('post-content-callback' => 'wp_bootstrap_content_output') );

in this example the layout with the slug 'page-layout' will be used.

2. Assign the layout to the entire 'page' post type from Layouts listing page or from the layout editor.

Hope this helps, please let me know if you need further help / explanation.
Riccardo

#268850

Thanks for the assistance, greatly appreciated.
I have tested this using option 1 as stated and it works.
But this is not ideal as the better solution would be to be able to choose the layout from the template selector on the page.
I am assuming that your suggestion in option 2 is the better "best practice" and would allow the selection of the layout in the template selector.
Can you elaborate a bit more on this option and in particular which template should be updated.

#269354

Dear Paul,

I absolutely agree with you, and in fact Layouts Plugin works like so, but you should have at least one template created and compatible with Layouts, so it should be a .php file with, this comment at the beginning:

/**
 * Template Name: Your Template name
 * 
 */

and this function call in the body:

the_ddlayout( 'page-layout', array('post-content-callback' => 'wp_bootstrap_content_output') );

The page.php file si not meant at all for that, it is not the file you're loading as a template with the template selector (http://codex.wordpress.org/Template_Hierarchy).

I strongly suggest to download our Layout compatible Bootstrap 3 Theme and have a look for inspiration, you'll find anything you need to know there in order to achieve this result.

Hope this helps,
Riccardo

#275233

Hi Guys
I have been components of toolset yet, that which seems the simplest is still baffling me.
I decided to try and integrate with a bootstrap 3 theme , Dazzling.
From what that documentation seems to state the process is as follows
1. create a child theme directory dazzling-child
2. Create style.css
3. create the functions.php in the child theme directory

<?php
 
add_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_style' );
function enqueue_parent_theme_style() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
ddlayout_set_framework('bootstrap-3');

3. Create a new page called Home with a slug home.
4. create a layout with a slug of home-layout and configured it to use the Home page
5. create a page template page-home.php in the child theme directory.

<?php
/*
Template Name: Home
*/

get_header(); ?>
<div id="content" class="site-content container">
	<div id="primary" class="content-area col-sm-12 col-md-8 <?php echo of_get_option( 'site_layout', 'no entry' ); ?>">
		<main id="main" class="site-main" role="main">
			<?php
			the_ddlayout( 'home-layout' );
			?>
		</main><!-- #main -->
	</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

5. Assigned home-layout to the page attributes "templates and layouts
That seems straight forward enough but the layout does not display.

Even when I go to the Layout editor and try to display the layout it does not display. the only partial success I had was when I selected to display a sample page when I enabled the layout for all pages.

#275660

Dear Paul,

I've set the your next reply as private to allow you to provide server access informations (admin credentials and FTP).

Can you please provide and I'll take a look into it to solve the issue?

Thanks in advance,
Riccardo

Le forum ‘Types Community Support’ est fermé à de nouveaux sujets et réponses.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.