Archived topic
Full-width Archive - No Sidebars
3 replies · Started by Steven on July 31, 2017
I need my archive pages to be full-width, no page title and no sidebar. Since there's not a page where I can choose these settings, is there some php I can add to my functions.php to make this happen.
Thanks
Hi Steven,
For full width and remove archive title, try this CSS:
.archive .grid-container {
max-width: 100%
}
.archive .page-header {
display: none;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
For removing sidebar, try this filter:
add_filter( 'generate_sidebar_layout','tu_custom_category_sidebar_layout' );
function tu_custom_category_sidebar_layout( $layout )
{
if ( is_archive() )
return 'no-sidebar';
return $layout;
}
Adding PHP: https://docs.generatepress.com/article/adding-php/
https://docs.generatepress.com/article/sidebar-layout/#using-a-function
Thanks for the code. The function made my site inaccessible. I had to remove it. Any idea why?
Just making sure. The first block is CSS so it can't go into function file.
I just tested the sidebar removal and the code worked. Can you try it with Code Snippets?
https://docs.generatepress.com/article/adding-php/#code-snippets