Hello HivePress Community,
I am currently facing a challenge with customizing the layout of the Vendor View Page in my HivePress theme, and I would greatly appreciate any guidance or assistance you can provide.
What I’m Trying to Achieve:
- Remove Sidebar: I want to remove or hide the sidebar from the Vendor View Page.
- Full-Width Content: After removing the sidebar, I wish to extend the main content area to full width.
- Repositioning Elements: Ideally, the elements that are currently in the sidebar should be moved to either the bottom of the page or integrated into the main content area in a seamless manner.
Attempts Made So Far:
*I’ve tried manipulating the layout through PHP filters, specifically using hivepress/v1/templates/vendor_view_page
, to rearrange or remove elements, but unfortunately, this hasn’t worked as expected.
- Is there a recommended way in HivePress to remove the sidebar from the Vendor View Page and adjust the layout accordingly?
- Can the elements from the sidebar be repositioned to the main content area or page footer using PHP filters or another method within HivePress?
Any code snippets, tips, or insights on how to achieve this would be immensely helpful. I have some familiarity with PHP and CSS, so I’m open to trying out solutions that involve code modifications.
Thank you in advance for your time and assistance!
add_filter(
'hivepress/v1/templates/vendor_view_page',
function( $template ) {
// Vérifier si les blocs existent dans le sidebar.
if (isset($template['blocks']['page_sidebar'])) {
// Sauvegarder les blocs du sidebar.
$sidebar_blocks = $template['blocks']['page_sidebar']['blocks'];
// Supprimer le sidebar.
unset($template['blocks']['page_sidebar']);
// Ajouter les blocs du sidebar à une autre zone, par exemple 'page_footer'.
$modified_blocks = [];
foreach ($sidebar_blocks as $block_key => $block) {
$modified_blocks[$block_key] = array_merge(
$block,
['_order' => 1000] // Utiliser une valeur élevée pour '_order'.
);
}
// Fusionner les blocs modifiés avec le template existant.
$template = hivepress()->helper->merge_trees(
$template,
['blocks' => ['page_footer' => ['blocks' => $modified_blocks]]]
);
}
return $template;
},
1000
);