Skip Navigation

[Closed] Templates not displaying correctly

This support ticket is created 7 years, 3 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by Nigel 7 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#479532

Trying to create a template.

Many issues. First, its inserted in a blog post layout. There is a main image above my content.

And there are other elements on the page like related posts, etc. that i do not want on the post.

How do you get rid of all these unwanted elements? I bought this plugin thinking it would create a blank content template to fit inside main template/theme.

hidden link

#479715

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Derrick

There a few points to grasp here.

Firstly, it is important to understand how the different parts of the page are generated.

WordPress pages are generated in blocks: the header, including the site navigation, the footer, one or more sidebars, and then the content itself. When viewing a single post the content is that single post. If you view an archive page (e.g. the blog, which is a list of standard posts, or an archive of a custom post type, or a category or author archive, etc.) then the content area is the list of posts.

You can see a visual representation of this here: https://toolset.com/documentation/user-guides/view-templates/#attachment_183885

If you use Types to create custom post types with associated custom fields and taxonomies and do nothing else, then your single custom posts and archive of posts will be output according to your theme's PHP templates, just like standard posts.

That means they won't output any of your custom taxonomies or custom fields, and the design will match that of regular blog posts (e.g. it may have a prominent featured image).

Which is where Views comes in, allowing you to create Content Templates for your custom post types so that you can design the output to include your custom fields and taxonomies according to your needs, and only including elements such as the featured image if you want to.

You can also customise the archive of your custom post types, or create custom searches for them.

But all this still only affects the content area of the page.

Many themes will have different page layouts (e.g. you can choose whether or not to have sidebars or full-width page layout), but Views will only affect the content area of the page, whatever your theme determines that to be.

So the next step is Layouts. If it is integrated with your theme then it gives you complete control over the whole page layout, and not just the content area. So instead of the header, footer, and sidebars coming from your theme, you create them in Layouts, and can assign different designs to different pages (e.g. use a different headers to your home page, to your blog, and to one of your custom post types).

That's how the pieces fit together. As a rule of thumb I normally suggest you start with Types and Views in combination with your theme and the customisations it allows, and if you envisage scenarios where that will not give you sufficient control over the page design, then add Layouts to the mix.

There is no substitute to working through some of the documentation, to see how to create Content Templates, for example, which is described in the link I shared above, for example.

You can read more about Layouts theme integration here: https://toolset.com/documentation/user-guides/layouts-theme-integration/

Note that the next major release of Layouts will work with themes that have not been integrated, but it will only be possible to design the content area with them.

#480019

Ok yeah I had pieced most of that together, but you helped complete my understanding. I really love your solutions and plan to rebuild our business directory site one day.

I'm using Bridge theme by Qode, a very popular theme for the issue in this ticket.

So according to my understanding, you replace the index.php, etc files with yours in my theme and that will integrate Layouts w my theme?

#480031

Ok i added your layout theme files to my child theme directory and followed the directions here - https://toolset.com/documentation/user-guides/layouts-theme-integration/#popular-integrated-themes, but its not working.
I assigned layout to Properties (my post type) and still getting integtration warning on the poperty edit page saying that Layouts is not integrated w theme.

Something definitely not working here. I really hoped Toolset would work for us but its looking like its not going to. might have to get a refund.

#480342

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Derrick

Can you describe exactly what you did to integrate your theme?

If you are using a child theme you can copy the PHP template files from the parent theme directory to the child theme and make your edits to the child theme files.

The required files will vary according to the theme, but you are likely to need to edit at a minimum single.php, archive.php and index.php.

You are looking to replace the loop section with the layouts function dd_layouts(), as described on the page you linked to.

Here, for example is the single.php template from the twentyseventeen theme before and after the changes:

** BEFORE **
get_header(); ?>

<div class="wrap">
	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">

			<?php
				/* Start the Loop */
				while ( have_posts() ) : the_post();

					get_template_part( 'template-parts/post/content', get_post_format() );

					// If comments are open or we have at least one comment, load up the comment template.
					if ( comments_open() || get_comments_number() ) :
						comments_template();
					endif;

					the_post_navigation( array(
						'prev_text' => '<span class="screen-reader-text">' . __( 'Previous Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Previous', 'twentyseventeen' ) . '</span> <span class="nav-title"><span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '</span>%title</span>',
						'next_text' => '<span class="screen-reader-text">' . __( 'Next Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Next', 'twentyseventeen' ) . '</span> <span class="nav-title">%title<span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ) . '</span></span>',
					) );

				endwhile; // End of the loop.
			?>

		</main><!-- #main -->
	</div><!-- #primary -->
	<?php get_sidebar(); ?>
</div><!-- .wrap -->

<?php get_footer();

*** AFTER ***
get_header(); ?>

<div class="wrap">
	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">

			<?php
				/* Start the Loop */

				the_ddlayout();

				// End of the loop.
			?>

		</main><!-- #main -->
	</div><!-- #primary -->
	<?php get_sidebar(); ?>
</div><!-- .wrap -->

<?php get_footer();

You'll need to do the same for all of your theme template files.

If you are getting messages to say that the theme is not integrated then it sounds like you haven't completed this step.

The topic ‘[Closed] Templates not displaying correctly’ is closed to new replies.