I have this theme on my ecommerce website and its called Soma. He is great but sadly, the team doesn't support anymore.
The question I have is how can I set up a category as a page? Cause on this particularly theme, the sidebar menu doesn't show up on normal pages, just on shop pages and categories pages.
I need to create a page that shows only one type of product, that's ease with woocommerce code. But the problem is that on that page, it doesn't show the sidebar menu.
I will put some prints here, maybe it can help.
I'm a beginner on php so I'm sorry if this is a dumb question but I looked all over the internet and I didn't find anything related. print of the problem
<?php
/*
Default Template Page
*/
get_header();
if (have_posts()) : while (have_posts()) : the_post();
$soma_vc = preg_match("/\[vc_row.*?\]/i", get_the_content());
$soma_page_class = "container";
if ($soma_vc && function_exists('vc_map')) {
$soma_page_class = "n-container";
}
?>
<div class="<?php echo esc_attr($soma_page_class) ?>">
<?php
the_content();
// WP Link Pages
$args = array(
'before' => '<div class="navigation">',
'after' => '</div>'
);
wp_link_pages($args);
?>
</div>
<?php
endwhile; endif;
// Comments
comments_template();
get_footer();
And this is what I need to put there:
<?php if($soma_shop_sidebar != '2' && is_active_sidebar('shop-sidebar')) : ?>
<div class="soma-overlay" id="woo-sidebar_overlay"></div>
<div class="woo-sidebar fixed-lateral left item-delay_off">
<div class="hide-scrollbar">
<div class="inner-hide_scrollbar">
<div class="woo-sidebar_padding">
<a href="#" class="sidebar-close_button"><?php echo esc_html__('Close', 'soma') ?></a>
<?php get_sidebar('shop'); ?>
</div>
</div>
</div>
</div>
This is one is still tough to assist on without seeing the full source of Soma, which isn't open-source.
However, if you simply need to customize the template used to display a single category, and there isn't a category.php
template in the theme yet, this is the procedure:
Referring to the WordPress Template Hierarchy , you'll want to create a custom template called category.php
If you want the layout for this page to be similar to another existing template, simply copy that template's code into category.php
to begin.
Add the sidebar code you've posted into your new category.php template, wherever it belongs in the layout.
If you're not sure where to put it, or you'd like to include a sidebar template in the same way that the Shop and Categories pages do:
category.php
file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.