|
Preselect specific Layout for “pages” created by NextGen Gallery
Started by: webD-3
in: Toolset Professional Support
Quick solution available
Problem: I have Layout A assigned as the Layout for the Pages post type. However, under certain circumstances I would like to preselect Layout B when a Page is being created in wp-admin.
Solution: There's not a filter available to manipulate the selected Layout here, but you could use the WordPress "save_post" hook to override the User's Layout selection when the post is saved.
function override_default_layout( $post_id ) {
if( get_post_type($post_id) == 'page' && wp_get_post_parent_id( $post_id ) == 1234 ) {
// this page is a child of the page with ID 1234 so we need to update the _layouts_template postmeta
update_post_meta( $post_id, '_layouts_template', 'template-slug');
}
}
add_action( 'save_post', 'override_default_layout', 100 );
Change '1234' to match the numeric ID of the Photos page, and change 'template-slug' to match the slug of the correct Layout. This way, no matter what is selected, the correct Layout will be applied.
Relevant Documentation: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
|
|
2 |
3 |
7 years ago
webD-3
|
|
Layout for a single page with a genesis child theme is ok, but the same Layout on an archive is different
Started by: charlie
in: Toolset Professional Support
Quick solution available
Problem: On the archive page, my content is displayed without any padding. On the single post page, the padding is fine.
Solution: In this case, your theme is removing the padding on these pages. You can override that with the following CSS:
.post-type-archive-lettura.imagely-grid .content {
padding: inherit;
}
.post-type-archive-lettura.imagely-grid .footer-widgets {
display: block;
}
|
|
2 |
3 |
7 years ago
charlie
|