' .wp_kses_post( paginate_links( array( 'prev_text' => __('', 'becommerce-store'), 'next_text' => __('', 'becommerce-store')) ) ). '';
}
add_action( 'becommerce_store_pagination_hook', 'becommerce_store_pagination' );
endif;
/**
* Registers a widget area.
*
* @link https://developer.wordpress.org/reference/functions/register_sidebar/
*
*/
add_action( 'widgets_init', 'becommerce_store_sidebars' );
function becommerce_store_sidebars(){
register_sidebar( array(
'name' => esc_html__( 'BeCommerce Store Main Sidebar', 'becommerce-store' ),
'id' => 'becommerce_store-sidebar-1',
'description' => esc_html__( 'Drag and drop your widgets here.', 'becommerce-store' ),
'before_widget' => '',
'before_title' => '
',
) );
if ( class_exists( 'WooCommerce' ) ) {
register_sidebar( array(
'name' => esc_html__( 'Woocommerce Shop Sidebar', 'becommerce-store' ),
'id' => 'woo_shop-sidebar',
'description' => esc_html__( 'Drag and drop your widgets here.', 'becommerce-store' ),
'before_widget' => '',
'before_title' => '',
) );
}
register_sidebar(
array(
'name' => esc_html__( 'Footer Middle Coloum 1', 'becommerce-store' ),
'id' => 'footer-mid-1',
'description' => esc_html__( 'The footer widget area 1st column.', 'becommerce-store' ),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Middle Column 2', 'becommerce-store' ),
'id' => 'footer-mid-2',
'description' => esc_html__( 'The footer widget area 3nd column.', 'becommerce-store' ),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Middle Column 3', 'becommerce-store' ),
'id' => 'footer-mid-3',
'description' => esc_html__( 'The footer widget area 3th column.', 'becommerce-store' ),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Middle Column 4', 'becommerce-store' ),
'id' => 'footer-mid-4',
'description' => esc_html__( 'The footer widget area 4th column.', 'becommerce-store' ),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
)
);
register_widget( 'becommerce_store_categories_Widget' );
register_widget( 'becommerce_store_about_footer_Widget' ); // Footer
register_widget( 'becommerce_store_menu_Footer_Widget' ); // Footer
}
require_once becommerce_store_inc .'/widgets/widget-categories.php';
require_once becommerce_store_inc .'/widgets/widget-about-footer.php';
require_once becommerce_store_inc .'/widgets/widget-menu-footer.php';
if ( ! function_exists( 'becommerce_store_schema_attr_header' ) ) :
/**
* Adds schema tags to the body tag.
*
* @echo html markup attributes
*/
function becommerce_store_schema_attr_header() {
$type_item = ( ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) ) ? 'Blog' : BE\becommerce_store_generate_defaults('itemtype');
$type_item = ( is_search() ) ? 'SearchResultsPage' : BE\becommerce_store_generate_defaults('itemtype');
$type_item_f = apply_filters( 'becommerce_store_schema_attr_header_typeofitem', $type_item );
echo apply_filters( 'becommerce_store_schema_attr_header', "itemtype='https://schema.org/" . esc_attr( $type_item_f ) . "' itemscope='itemscope'" ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if( ! function_exists( 'becommerce_store_code_icon_func' )) :
function becommerce_store_code_icon_func( ) {
$icon_func = array(
'prefix' => 'bi bi-',
'icon' => 'anchor',
'protocol' => 'https://',
'size' => '', // fg-lg, fg-2x for example...
'custom' => '',
'color' => '',
);
$size = $icon_func['size'];
$color = $icon_func['color'];
$prefix = $icon_func['prefix'];
$icon = $icon_func['icon'];
$custom = $icon_func['custom'];
$anc = '';
if('' != $color)
$anc .= ' style="color: '.$color.';"';
$markup = ''; $marrkup = $icon_func['protocol'];
if('' != $custom)
$markup = '';
return $marrkup;
}
endif;
if ( ! function_exists( 'becommerce_store_optional_thumbnail_post' ) ) :
/**
* Displays an optional post thumbnail.
*/
function becommerce_store_optional_thumbnail_post() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
the_title_attribute(
array(
'echo' => false
)
),
)
);
?>
';
$args = array(
'cat' => $item->object_id,
'posts_per_page' => 4,
'ignore_sticky_posts' => 1
);
$default = apply_filters( 'becommerce_store_megamenu_posts_args', $args );
$posts = new WP_Query( $default );
if ( $posts->have_posts() ) :
while ( $posts->have_posts() ) : $posts->the_post();
$output .= '';
$output .= '';
if ( has_post_thumbnail() ) {
$output .= get_the_post_thumbnail( get_the_ID(), 'becommerce_store-megamenu-posts', array( 'class' => 'entry-thumbnail', 'alt' => esc_attr( get_the_title() ) ) );
} else {
$output .= '
';
}
if ( has_post_format( 'video' ) ) {
$output .= '';
$output .= '';
$output .= '';
}
$output .= '' . esc_attr( get_the_title() ) . '
';
$output .= '';
$output .= '';
endwhile;
endif;
wp_reset_postdata();
$output .= '';
return $output;
}
// add_filter( 'becommerce_store_mega_menu_end_lvl', 'becommerce_store_get_latest_posts' );
if( ! function_exists( 'becommerce_store_code_url_func' )) :
// url
function becommerce_store_code_url_func($entrya, $entryb, $path = '') {
$social_func = array(
'prefix' => 'fa fa-',
'icon' => 'twitter',
'custom' => '',
'color' => '',
'target' => BE\becommerce_store_generate_defaults('a_target'),
'type' => 'circle', // circle or square
'size' => '',
'protocol' => 'www.',
'link' => '#',
);
$type = $social_func['type'];
$size = $social_func['size'];
$color = $social_func['color'];
$prefix = $social_func['prefix'];
$icon = $social_func['icon'];
$custom = $social_func['custom'];
$style = '';
$classes = '';
if( $type == 'none') {
$classes .= ' nb-social-icon-none';
$icon .= ' ' .$size;
} else {
$classes .= ' style-'. $style . ' fa-stack ' . $size . ' ' . $type;
}
if('' != $color)
$style .= ' style="color: '.$color.';"';
$markupp = ''; $marrkup = $social_func['protocol'];
if('' != $custom)
$markupp = '';
return ''. $entryb . '';
}
endif;
if ( ! function_exists( 'becommerce_store_related_posts' ) ) :
/**
* Related posts.
*
* @since 1.0.0
*/
function becommerce_store_related_posts() {
// Get the data set in customizer
$enable = BE\becommerce_store_get_mod('related-posts' );
$title = BE\becommerce_store_get_mod( 'related_posts_title');
// Disable if user choose it.
if ( $enable == 0 ) {
return;
}
// Polylang integration
//if ( is_polylang_activated() ) {
// $title = pll__( $defaults[ 'related_posts_title' ] );
//}
// Get the taxonomy terms of the current page for the specified taxonomy.
$terms = wp_get_post_terms( get_the_ID(), 'category', array( 'fields' => 'ids' ) );
// Bail if the term empty.
if ( empty( $terms ) ) {
return;
}
// Posts query arguments.
$query = array(
'post__not_in' => array( get_the_ID() ),
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $terms,
'operator' => 'IN'
)
),
'posts_per_page' => 5,
'post_type' => 'post',
);
// Allow dev to filter the query.
$args = apply_filters( 'becommerce_store_related_posts_args', $query );
// The post query
$related = new WP_Query( $args );
if ( $related->have_posts() ) : $i = 1; ?>
have_posts() ) : $related->the_post();
$class = ( 0 == $i % 3 ) ? 'hentry grid last' : 'hentry grid';
?>