[英]How can I set up a taxonomy category as my page on wordpress?
I have this theme on my ecommerce website and its called Soma.我的电子商务网站上有这个主题,它叫做 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.我需要创建一个只显示一种产品类型的页面,使用 woocommerce 代码很容易。 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.我是 php 的初学者,所以如果这是一个愚蠢的问题,我很抱歉,但我浏览了整个互联网,但没有找到任何相关内容。 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.如果没有看到非开源的 Soma 的完整源代码,这仍然很难提供帮助。
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:但是,如果您只是需要自定义用于显示单个类别的模板,并且主题中还没有
category.php
模板,则过程如下:
Referring to the WordPress Template Hierarchy , you'll want to create a custom template called category.php
参考WordPress 模板层次结构,您需要创建一个名为
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.如果您希望此页面的布局与另一个现有模板相似,只需将该模板的代码复制到
category.php
即可开始。
Add the sidebar code you've posted into your new category.php template, wherever it belongs in the layout.将您发布的侧边栏代码添加到新类别中。php 模板,无论它属于布局中的什么位置。
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
filecategory.php
文件中做同样的事情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.