April 2nd, 2021 at 01:00 #116168
I’m using a 2-column main-layout setting from Mantra > Layout Settings (the second from the left) and then choosing the one-column, no-sidebar template under WP > Edit Page, Page Attributes > Template, for every page except for my Posts page.
I’m doing this because Template doesn’t seem to be an option under Page Attributes for the Posts page. This seems to be true across themes.
If it were an option, I’d choose the One Column, no-sidebar main layout under Mantra > Layout Settings, and then change the Posts page to the two-column template.
Is there a more efficient way to do what I want to do? Is there any way to enable only my Posts page to use the two-column layout, and have everything else use the one-column layout?
Thanks much!April 4th, 2021 at 20:55 #116275
I added a child theme, using this excellent tutorial, but I’m still at a loss at how best to implement this. Thanks much!April 5th, 2021 at 22:50 #116329ZedCryout Creations Team
Mantra does not have built-in support for custom layouts for posts – this functionality only exists for pages using the available page templates.
Adding custom layouts for posts (all posts or individual posts) would require custom code to detect the site section and override the theme’s computed layout.
The code responsible for layout decisions is located in
sidebar.php.April 6th, 2021 at 19:51 #116380
Thank you, Zed! I’m trying to figure this out. As for detecting the site section, this should simply be the page ID, since I’m interested in overriding the theme’s computed layout on that one page in particular, the wordpress-designated Posts page.
What baffles me is that I can add this line to my child-theme’s
update_post_meta( N, '_wp_page_template', 'templates/template-twocolumns-right.php' );
where N = any page except the Posts page, and it will work.
However, I can go to Mantra > Layout Settings, and change my Posts page to whatever layout I want, as long as I change every single other page on the site along with it. So the Posts page should be able to conform to any of these layouts on its own, shouldn’t it?
But the Posts page behaves differently than the others, in that unlike all the others, it’s not possible to change this page individually.
Is that behavior governed by the code in
sidebar.php?April 10th, 2021 at 21:56 #116585
Ok I’m still working on this! By the way, in this post I’ve been saying “Posts Page,” because that’s what it’s called in the WP interface, but I just learned that the technical term for the page I’d like to have a different layout from the rest is my Archive Page.
So I took a look at archive.php, and I changed these lines
<?php /* Include the Post-Format-specific template for the content. * If you want to overload this in a child theme then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content/content', get_post_format() ); ?>
<?php /* Include the Post-Format-specific template for the content. * If you want to overload this in a child theme then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content-twocolumns-right.php', get_post_format() ); ?>
And then I took
templates/template-twocolumns-right.php, renamed it
content-twocolumns-right.php, and placed in my child theme folder along with the other files.
But this had no effect.
Can anyone tell me what I’m doing wrong, or if I’m even on the right track in solving this problem?
Many thanks!April 12th, 2021 at 04:14 #116634
Ok never mind my last post; I am working on changing the behavior of the “Posts Page,” (set in WP Settings > Reading) not the Archive Page.
You need to log in to reply to this topic.