Customizing Layout and Removing Sidebar on Vendor View Page in HivePress

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:

  1. Remove Sidebar: I want to remove or hide the sidebar from the Vendor View Page.
  2. Full-Width Content: After removing the sidebar, I wish to extend the main content area to full width.
  3. 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
);
1 Like

Hi! If you want to make a vendors view page without a sidebar, just make a new page from the wordpress admin area. pages–>add new–> add a title what you want–>click on the + button, and search for hivepress vendors block. click on it, now you have a new vendors area page, with full width. If you want, set columns for that (maximum 4 columns), for the bottom menus, add again a block with + and search what blocks you want to place. You can move that up and down just click on the block, and use the block editor arrows. Refresh your work (top right), and now view in live.

Hello, thank you for your response. I do not wish to modify the host list, but rather the host detail page. There is no available block for creating a new page.

Hi,

You can customize templates in HivePress > Templates or using child theme, please check these docs: How to customize templates - HivePress Help Center, How to override template parts - HivePress Help Center

​I hope this is helpful to you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.