implode( '&family=', $board_games_font_families ),
'display' => 'swap',
), 'https://fonts.googleapis.com/css2' );
return esc_url_raw($board_games_fonts_url);
}
endif;
if ( ! function_exists( 'board_games_sub_menu_toggle_button' ) ) :
function board_games_sub_menu_toggle_button( $board_games_args, $board_games_item, $depth ) {
// Add sub menu toggles to the main menu with toggles
if ( $board_games_args->theme_location == 'board-games-primary-menu' && isset( $board_games_args->show_toggles ) ) {
// Wrap the menu item link contents in a div, used for positioning
$board_games_args->before = '
';
// Add sub menu icons to the main menu without toggles (the fallback menu)
}elseif( $board_games_args->theme_location == 'board-games-primary-menu' ) {
if ( in_array( 'menu-item-has-children', $board_games_item->classes ) ) {
$board_games_args->before = '';
$board_games_args->after = board_games_get_theme_svg( 'chevron-down' ) . '
';
} else {
$board_games_args->before = '';
$board_games_args->after = '';
}
}
return $board_games_args;
}
endif;
add_filter( 'nav_menu_item_args', 'board_games_sub_menu_toggle_button', 10, 3 );
if ( ! function_exists( 'board_games_the_theme_svg' ) ):
function board_games_the_theme_svg( $board_games_svg_name, $board_games_return = false ) {
if( $board_games_return ){
return board_games_get_theme_svg( $board_games_svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in board_games_get_theme_svg();.
}else{
echo board_games_get_theme_svg( $board_games_svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in board_games_get_theme_svg();.
}
}
endif;
if ( ! function_exists( 'board_games_get_theme_svg' ) ):
function board_games_get_theme_svg( $board_games_svg_name ) {
// Make sure that only our allowed tags and attributes are included.
$board_games_svg = wp_kses(
Board_Games_SVG_Icons::get_svg( $board_games_svg_name ),
array(
'svg' => array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
'polyline' => array(
'fill' => true,
'points' => true,
),
'line' => array(
'fill' => true,
'x1' => true,
'x2' => true,
'y1' => true,
'y2' => true,
),
)
);
if ( ! $board_games_svg ) {
return false;
}
return $board_games_svg;
}
endif;
if( !function_exists( 'board_games_post_category_list' ) ) :
// Post Category List.
function board_games_post_category_list( $board_games_select_cat = true ){
$board_games_post_cat_lists = get_categories(
array(
'hide_empty' => '0',
'exclude' => '1',
)
);
$board_games_post_cat_cat_array = array();
if( $board_games_select_cat ){
$board_games_post_cat_cat_array[''] = esc_html__( '-- Select Category --','board-games' );
}
foreach ( $board_games_post_cat_lists as $board_games_post_cat_list ) {
$board_games_post_cat_cat_array[$board_games_post_cat_list->slug] = $board_games_post_cat_list->name;
}
return $board_games_post_cat_cat_array;
}
endif;
if( !function_exists('board_games_single_post_navigation') ):
function board_games_single_post_navigation(){
$board_games_default = board_games_get_default_theme_options();
$board_games_twp_navigation_type = esc_attr( get_post_meta( get_the_ID(), 'board_games_twp_disable_ajax_load_next_post', true ) );
$board_games_current_id = '';
$article_wrap_class = '';
global $post;
$board_games_current_id = $post->ID;
if( $board_games_twp_navigation_type == '' || $board_games_twp_navigation_type == 'global-layout' ){
$board_games_twp_navigation_type = get_theme_mod('board_games_twp_navigation_type', $board_games_default['board_games_twp_navigation_type']);
}
if( $board_games_twp_navigation_type != 'no-navigation' && 'post' === get_post_type() ){
if( $board_games_twp_navigation_type == 'theme-normal-navigation' ){ ?>
'' . board_games_the_theme_svg('arrow-left',$board_games_return = true ) . ' ' . esc_html__('Previous post:', 'board-games') . ' %title ',
'next_text' => '' . board_games_the_theme_svg('arrow-right',$board_games_return = true ) . ' ' . esc_html__('Next post:', 'board-games') . ' %title ',
)); ?>
ID ) ){
$board_games_next_post_id = $board_games_next_post->ID;
echo '
';
}
}
}
}
endif;
add_action( 'board_games_navigation_action','board_games_single_post_navigation',30 );
if( !function_exists('board_games_content_offcanvas') ):
// Offcanvas Contents
function board_games_content_offcanvas(){ ?>
'product',
'posts_per_page' => 100,
'product_cat' => $board_games_catData,
'order' => 'ASC'
); ?>
have_posts() ) : $board_games_loop->the_post();
global $product;
$product_id = $product->get_id(); // Get product ID dynamically
?>
post->ID )) echo get_the_post_thumbnail($board_games_loop->post->ID, 'shop_catalog'); else echo ' '; ?>
is_type( 'simple' ) ) { woocommerce_template_loop_add_to_cart( $board_games_loop->post, $product );} ?>
get_id(), 'product_cat' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$first_term = $terms[0];
echo '' . esc_html( $first_term->name ) . ' ';
}
?>
get_price_html(); ?>
'.esc_html( $board_games_title ).''; } ?>
array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
)
);
if ( ! $board_games_svg ) {
return false;
}
return $board_games_svg;
}
endif;
if( !function_exists( 'board_games_sanitize_sidebar_option_meta' ) ) :
// Sidebar Option Sanitize.
function board_games_sanitize_sidebar_option_meta( $board_games_input ){
$board_games_metabox_options = array( 'global-sidebar','left-sidebar','right-sidebar','no-sidebar' );
if( in_array( $board_games_input,$board_games_metabox_options ) ){
return $board_games_input;
}else{
return '';
}
}
endif;
if( !function_exists( 'board_games_sanitize_pagination_meta' ) ) :
// Sidebar Option Sanitize.
function board_games_sanitize_pagination_meta( $board_games_input ){
$board_games_metabox_options = array( 'Center','Right','Left');
if( in_array( $board_games_input,$board_games_metabox_options ) ){
return $board_games_input;
}else{
return '';
}
}
endif;
if( !function_exists( 'board_games_sanitize_menu_transform' ) ) :
// Sidebar Option Sanitize.
function board_games_sanitize_menu_transform( $board_games_input ){
$board_games_metabox_options = array( 'capitalize','uppercase','lowercase');
if( in_array( $board_games_input,$board_games_metabox_options ) ){
return $board_games_input;
}else{
return '';
}
}
endif;
if( !function_exists( 'board_games_sanitize_page_content_alignment' ) ) :
// Sidebar Option Sanitize.
function board_games_sanitize_page_content_alignment( $board_games_input ){
$board_games_metabox_options = array( 'left','center','right');
if( in_array( $board_games_input,$board_games_metabox_options ) ){
return $board_games_input;
}else{
return '';
}
}
endif;
if( !function_exists( 'board_games_sanitize_footer_widget_title_alignment' ) ) :
// Footer Option Sanitize.
function board_games_sanitize_footer_widget_title_alignment( $board_games_input ){
$board_games_metabox_options = array( 'left','center','right');
if( in_array( $board_games_input,$board_games_metabox_options ) ){
return $board_games_input;
}else{
return '';
}
}
endif;
if( !function_exists( 'board_games_sanitize_pagination_type' ) ) :
/**
* Sanitize the pagination type setting.
*
* @param string $board_games_input The input value from the Customizer.
* @return string The sanitized value.
*/
function board_games_sanitize_pagination_type( $board_games_input ) {
// Define valid options for the pagination type.
$board_games_valid_options = array( 'numeric', 'newer_older' ); // Update valid options to include 'newer_older'
// If the input is one of the valid options, return it. Otherwise, return the default option ('numeric').
if ( in_array( $board_games_input, $board_games_valid_options, true ) ) {
return $board_games_input;
} else {
// Return 'numeric' as the fallback if the input is invalid.
return 'numeric';
}
}
endif;
// Sanitize the enable/disable setting for pagination
if( !function_exists('board_games_sanitize_enable_pagination') ) :
function board_games_sanitize_enable_pagination( $board_games_input ) {
return (bool) $board_games_input;
}
endif;
if( !function_exists( 'board_games_sanitize_copyright_alignment_meta' ) ) :
// Sidebar Option Sanitize.
function board_games_sanitize_copyright_alignment_meta( $board_games_input ){
$board_games_metabox_options = array( 'Default','Reverse','Center');
if( in_array( $board_games_input,$board_games_metabox_options ) ){
return $board_games_input;
}else{
return '';
}
}
endif;
/**
* Sidebar Layout Function
*/
function board_games_get_final_sidebar_layout() {
$board_games_defaults = board_games_get_default_theme_options();
$board_games_global_layout = get_theme_mod('board_games_global_sidebar_layout', $board_games_defaults['board_games_global_sidebar_layout']);
$board_games_page_layout = get_theme_mod('board_games_page_sidebar_layout', $board_games_global_layout);
$board_games_post_layout = get_theme_mod('board_games_post_sidebar_layout', $board_games_global_layout);
$board_games_meta_layout = get_post_meta(get_the_ID(), 'board_games_post_sidebar_option', true);
if (!empty($board_games_meta_layout) && $board_games_meta_layout !== 'default') {
return $board_games_meta_layout;
}
if (is_page() || (function_exists('is_shop') && is_shop())) {
return $board_games_page_layout;
}
if (is_single()) {
return $board_games_post_layout;
}
return $board_games_global_layout;
}