我有一个网站,Woocommerce商店页面将类别放在左侧 . 当您调整到移动设备时,类别会弹出到页面底部 . 我希望它出现在顶部 . 我想用php做这个,而不是做一堆javascript更改或css规则 .
好的,我找到的解决方案是进入主题的文件夹,然后进入config-woocommerce文件夹 . 在config.php文件中,函数avia_woocommerce_after_main_content()有以下代码:
//get the sidebar if(!is_singular()) get_sidebar();
我从该函数中删除了该代码,并将其移至以下代码后面的函数avia_woocommerce_before_main_content:
$sidebar_setting = avia_layout_class( 'main' , false ); echo "<div class='container_wrap container_wrap_first main_color {$sidebar_setting} template-shop shop_columns_".$avia_config['shop_overview_column']."'>"; echo "<div class='container'>";
所以现在函数看起来像这样:
function avia_woocommerce_before_main_content()
{global $ avia_config;
if(!isset($avia_config['shop_overview_column'])) $avia_config['shop_overview_column'] = "auto"; $id = get_option('woocommerce_shop_page_id'); $layout = get_post_meta($id, 'layout', true); if(!empty($layout)) { $avia_config['layout']['current'] = $avia_config['layout'][$layout]; $avia_config['layout']['current']['main'] = $layout; } $avia_config['layout'] = apply_filters('avia_layout_filter', $avia_config['layout'], $id); $title_args = array(); if(is_woocommerce()) { $t_link = ""; if(is_shop()) $title = get_option('woocommerce_shop_page_title'); $shop_id = woocommerce_get_page_id('shop'); if($shop_id && $shop_id != -1) { if(empty($title)) $title = get_the_title($shop_id); $t_link = get_permalink($shop_id); } if(empty($title)) $title = __("Shop",'avia_framework'); if(is_product_category() || is_product_tag()) { global $wp_query; $tax = $wp_query->get_queried_object(); $title = $tax->name; $t_link = ''; } $title_args = array('title' => $title, 'link' => $t_link); } if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title($title_args); if(is_singular()) { $result = 'sidebar_right'; $avia_config['layout']['current'] = $avia_config['layout'][$result]; $avia_config['layout']['current']['main'] = $result; } $sidebar_setting = avia_layout_class( 'main' , false ); echo "<div class='container_wrap container_wrap_first main_color {$sidebar_setting} template-shop shop_columns_".$avia_config['shop_overview_column']."'>"; echo "<div class='container'>"; //get the sidebar if(!is_singular()) get_sidebar(); if(!is_singular()) { $avia_config['overview'] = true; }
}
这与enfold主题一起使用,我假设这将适用于每个主题 . 我必须弄乱css才能让它得到它以使页面看起来正确,但这是它的css部分 .
1 回答
好的,我找到的解决方案是进入主题的文件夹,然后进入config-woocommerce文件夹 . 在config.php文件中,函数avia_woocommerce_after_main_content()有以下代码:
我从该函数中删除了该代码,并将其移至以下代码后面的函数avia_woocommerce_before_main_content:
所以现在函数看起来像这样:
{global $ avia_config;
}
这与enfold主题一起使用,我假设这将适用于每个主题 . 我必须弄乱css才能让它得到它以使页面看起来正确,但这是它的css部分 .