';
echo '
';
wp_list_pages( array(
'title_li' => '',
'depth' => 1,
'number' => 5,
) );
echo '';
}
endif;
//=============================================================
// Alter body class function
//=============================================================
function blog_way_body_classes( $classes ) {
// Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) {
$classes[] = 'group-blog';
}
// Adds a class of hfeed to non-singular pages.
if ( ! is_singular() ) {
$classes[] = 'hfeed';
}
$sticky = blog_way_get_option( 'sticky' );
if( 1 != $sticky ){
$classes[] = 'sticky-top';
}
return $classes;
}
add_filter( 'body_class', 'blog_way_body_classes' );
//=============================================================
// Pingback function
//=============================================================
function blog_way_pingback_header() {
if ( is_singular() && pings_open() ) {
echo '';
}
}
add_action( 'wp_head', 'blog_way_pingback_header' );
if ( ! function_exists( 'blog_way_footer_goto_top' ) ) :
/**
* Add Go to top.
*
* @since 1.0.0
*/
function blog_way_footer_goto_top() {
$enable_scrollup = blog_way_get_option( 'enable_scrollup' );
if( 1 != $enable_scrollup ){
echo '';
}
}
endif;
add_action( 'wp_footer', 'blog_way_footer_goto_top' );
//=============================================================
// Sidebar assigning hook of the theme
//=============================================================
if ( ! function_exists( 'blog_way_sidebar_action' ) ) :
/**
* Add sidebar.
*
* @since 1.0.0
*/
function blog_way_sidebar_action() {
$global_layout = blog_way_get_option( 'global_layout' );
$global_layout = apply_filters( 'blog_way_filter_theme_global_layout', $global_layout );
// Include sidebar.
if ( 'no-sidebar' !== $global_layout ) {
get_sidebar();
}
}
endif;
add_action( 'blog_way_sidebar', 'blog_way_sidebar_action' );
//=============================================================
// Change number of product per row
//=============================================================
if (!function_exists('blog_way_product_columns')) {
function blog_way_product_columns() {
return 3; // 3 products per row
}
}
add_filter('loop_shop_columns', 'blog_way_product_columns');
//=============================================================
// Change number of related product
//=============================================================
function blog_way_related_products_args( $args ) {
$args['posts_per_page'] = 3; // 3 related products
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'blog_way_related_products_args' );
//=============================================================
// Change number of upsell products
//=============================================================
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
add_action( 'woocommerce_after_single_product_summary', 'blog_way_output_upsells', 15 );
if ( ! function_exists( 'blog_way_output_upsells' ) ) {
function blog_way_output_upsells() {
woocommerce_upsell_display( 3, 3 ); // Display 3 products in rows of 3
}
}
//=============================================================
// Hide archive page prefix
//=============================================================
if( ! function_exists( 'blog_way_archive_prefix_change' ) ):
function blog_way_archive_prefix_change( $title ) {
$archive_prefix = blog_way_get_option( 'archive_prefix' );
if( 1 === absint( $archive_prefix ) ){
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '' . get_the_author() . '';
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
} elseif ( is_tax() ) {
$title = single_term_title( '', false );
}
}
return $title;
}
endif;
add_filter( 'get_the_archive_title', 'blog_way_archive_prefix_change');