I am trying to add a layout to my page.php template. However I have forgotten how it should be done when I DONT want to use layouts to customize the whole page template.
I have made a post type called Ansatte. This post type should have the employers, which are currently 2. For this post type I have made an Archive page and Views. I have made them both because I was not sure which I should make when i ONLY wanted to include the "the_ddlayout" into one particular page. This is because they only want to show employers in one page, and no archieve page is currently needed.
In my page template I have added the following:
<?php the_ddlayout( 'default-layout' ); ?>
This is what I used last time I got this to work.
When I visit my page nothing comes up, and the content is only repeated infinity times.
Hope this explains it,
How do I solve this problem?
hidden link
Hi there,
It sounds like you want to use Layouts for the content area of this page, but you don't want to take over the design of the entire page. This is how Layouts works with any theme that is not "integrated", meaning that Layouts only affects the content area of your post or page and not the main site design, like headers and footers and sidebars and so forth. If this sounds like what you want, then you do not need to include "the_ddlayout()" anywhere in your page template. Your page.php file should instead call "the_post()" like usual, something like this:
if ( have_posts() ) : while ( have_posts() ) : the_post();
// Post Content here
endwhile; else :
//your theme's "No posts found" template call
endif;
Only include the_ddlayout() if you want to take over the entire site design. Let me know if you have questions about this.
Hello,
Currently I need the content area of this page to be shown. That`s why I am using a page template and not archive page.
It looks something like this:
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content('readmore', true); ?>
<?php the_ddlayout( 'default-layout' ); ?>
<?php endwhile; // end of the loop. ?>
How can I solve this problem?
Delete this:
<?php the_ddlayout( 'default-layout' ); ?>
Then edit the Layout you have applied to your page. Add a Post Content cell or add the post body to a Visual Editor cell. Screenshot attached showing the Post Content cell.
Okay, that sounds easy.
I have now edited my page template into the following:
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content('readmore', true); ?>
<?php endwhile; // end of the loop. ?>
I have made a Layout called Page Layout Content Only and set up Post Content. So at this point it shows the post content and not the archive part.
I added a row below with WordPress Archive. However, this does not appear on my page.
Any ideas?
Hi, I'm not sure I understand what you're trying to accomplish. It sounds like you want to include the content of a page, plus a WordPress Archive, on a single post. Toolset isn't designed to combine these two pieces of functionality - they're mutually exclusive. WordPress doesn't typically include post content and archives on the same page either.
I think the best approach will be to use a View instead of a WordPress Archive cell here. This View can be designed to display the same posts you would expect to see in your WordPress Archive. For example, if you want to show a list of Pages here, create your View to show Pages ordered by descending date. This will mimic the functionality of a WordPress Archive and allow you to combine the two features on a single post or page.
Please let me know if this does not make sense, and I can explain further. Thanks!
Yes, I would like to include the content of a page, plus a WordPress Archive.
I have already made a View for the post types, but not sure how to include it. It is suppose to be ordered by post date, descending.
I have inserted the View in Page Layout Content Only. Still shows nothing.
Not sure if I understand it correctly.
I used to do this on all of my pages earlier when I handcoded it, so it`s tempting to do the same now. But since I pay for this now I was hoping there would be a easier solution.
The idea is using content of a page so the user edit it the same way. None of my customers have enough competence to use layout or the other tools to edit their content. Easy editable content + an easy way to add employers which are updated automaticly to the same page.
Looking forward to hear from you again 🙂
Can you share the shortcode you have used to place your View in the page? Any screenshots you can share that show your View settings and Layouts structure will be helpful.
Okay, I post my screenhosts below.
Hope they explain it,
Thanks,
Okay I'll need to take a look at your wp-admin area to understand why this isn't working as expected. I would like to create a clone of your site using the Duplicator plugin, so I can install it locally and run tests without affecting your live site. If that is okay, please provide login credentials in the private reply fields here.
Hi, the main issue I see is in your functions.php file. As I understand it, you do not want to integrate your theme with Layouts. You want Layouts to be used only on the content of this page. Since your theme is not integrated with Layouts, so you should not use the ddl-is_integrated_theme hook and function:
add_filter( 'ddl-is_integrated_theme', 'theme_is_integrated_with_layouts' );
function theme_is_integrated_with_layouts() {
return true;
}
Please delete this code so that Layouts understands not to take over the design of your entire page. Then your View should work as expected. Let me know how it goes, or if you need additional information about this:
https://toolset.com/documentation/user-guides/layouts-theme-integration/