Sidebar when Front page displays is set to static page
hi,
i have issue related to sidebars.
my front page settings are like this: a page for front page, and another static page for posts page.
after this, i cannot assign sidebar to blog posts page.
i tried to solve it like this :
if (is_home() && get_option('page_for_posts') != '0' && get_option('show_on_front') == 'page') {
$data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::POST_TYPES_PREFIX);
$data['sub_type'] = 'page';
$data['id'] = get_queried_object_id();
$result = $this->get_preset_sidebars($data);
if ( $result )
return $result;
}
i am not sure if this is the right way.
now i have second issue, i do have woo commerce installed, and have shop page. from sidebars, i selects products from grouped pages and assign shop sidebar, and from specific pages, select shop page and assign the same sidebar. in product detail, the sidebar is shown, but in shop page, it is undefined.
should i use something like is_shop() in class-fw-extension-sidebars-frontend.php ?
thanks a lot.
Same issue here, I can not get sidebar to work with specific WooCommerce "Shop base" page. Any help would be appreciated. Thanks in advanced !
Hi @pudeco,
- Thank you, was fixed in the v1.0.1 of Unyson-Sidebars-Extension. It is available in Unyson plugin version
- Was added to the filter 'fw_ext_sidebars_conditional_tags' in the last update. It can be used to add other conditional tags such as 'is_shop()'
function _filter_fw_ext_sidebars_add_conditional_tag($data) {
$data['is_custom_shop_slug'] = array(
'order_option' => 2,
'check_priority' => 'first',
'name' => 'Shop page',
'conditional_tag' => array(
'callback' => 'is_shop',
)
);
return $data;
}
add_filter('fw_ext_sidebars_conditional_tags', '_filter_fw_ext_sidebars_add_conditional_tag' );
@pudeco, @RayNguyen Try to create the 'sidebars-shop.php' file in the root path of theme. After than put the next code into it:
<?php
/**
* The Shop Sidebar
*/
?>
<?php if ( function_exists('fw_ext_sidebars_get_current_position') ) : ?>
<?php $current_position = fw_ext_sidebars_get_current_position();?>
<?php if ($current_position !== 'full') : ?>
<?php if ($current_position === 'left' ) : ?>
<div>
<?php echo fw_ext_sidebars_show('blue'); ?>
</div>
<?php elseif ($current_position === 'right' ) : ?>
<div>
<?php echo fw_ext_sidebars_show('blue'); ?>
</div>
<?php elseif ($current_position === 'left_right' ) : ?>
<div>
<?php echo fw_ext_sidebars_show('blue'); ?>
</div>
<div>
<?php echo fw_ext_sidebars_show('yellow'); ?>
</div>
<?php endif;?>
<?php endif;?>
<?php endif; ?>
Hi, @player0k,
Thanks for your hard work. But I still can not get sidebar to work with WooCommerce shop page.
I just want to have something like this in file named class-fw-extension-sidebars-frontend.php
if (is_shop()) {
$data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::POST_TYPES_PREFIX);
$data['sub_type'] = 'page';
$data['id'] = woocommerce_get_page_id( 'shop' );
$result = $this->get_preset_sidebars($data);
if ( $result )
return $result;
}
@RayNguyen Can you see this changelog of the sidebars, I think that it can help you to solve problem with woocommerce page.If it helps please close the issue or give us a feedback.