set('toc', 1);
}
});
return str_replace( '
false,
)
);
return $args;
}
endif;
add_filter( 'widget_nav_menu_args', 'exs_filter_widget_nav_menu_args' );
//add custom image size to Gutenberg dropdown
add_filter( 'image_size_names_choose', 'exs_filter_image_size_names_choose' );
if ( ! function_exists( 'exs_filter_image_size_names_choose' ) ) :
function exs_filter_image_size_names_choose( $sizes ) {
return array_merge( $sizes, array(
'exs-square' => esc_html__( 'Square 800x800', 'exs' ),
'exs-square-half' => esc_html__( 'Half Square 800x400', 'exs' ),
) );
}
endif;
//filter page menu
if ( ! function_exists( 'exs_filter_wp_page_menu_args' ) ) :
function exs_filter_wp_page_menu_args( $args ) {
$args['menu_class'] = 'top-menu ';
$args['container'] = 'ul';
return $args;
}
endif;
add_filter( 'wp_page_menu_args', 'exs_filter_wp_page_menu_args' );
//add social icons to bottom menu and additional logo, search and meta to the mobile primary menu
if ( ! function_exists( 'exs_filter_nav_additional_links' ) ) :
function exs_filter_nav_additional_links( $items, $args ) {
//bottom menu
if( 'bottom' === $args->theme_location && exs_option( 'bottom_nav_show_social' ) ) {
$links = exs_social_links_html();
if ( ! empty( $links ) ) {
$items .= '
';
$items .= $links;
$items .= '';
}
}
//primary menu
if( 'primary' === $args->theme_location ) {
$items_before = '';
if ( exs_option( 'menu_mobile_show_logo' ) ) {
ob_start();
get_template_part( 'template-parts/header/logo/logo', exs_template_part( 'logo', '1' ) );
$html_logo = ob_get_clean();
$items_before .= '';
}
if ( exs_option( 'menu_mobile_show_search' ) ) {
ob_start();
get_search_form();
$html_search = ob_get_clean();
$items_before .= '';
}
if ( $items_before ) {
$items = $items_before . $items;
}
if ( exs_option( 'menu_mobile_show_meta' ) ) {
ob_start();
get_template_part( 'template-parts/site-meta' );
$html_meta = ob_get_clean();
if ( $html_meta ) {
$items = $items . '';
}
}
if ( exs_option( 'menu_mobile_show_social' ) ) {
$html_links = exs_social_links_html();
if ( $html_links ) {
$items = $items . '';
}
}
}
return $items;
}
endif;
add_filter( 'wp_nav_menu_items', 'exs_filter_nav_additional_links', 20, 2 );
//add avatar custom image if exist
if ( ! function_exists( 'exs_filter_custom_avatar_image_for_comments' ) ) :
function exs_filter_custom_avatar_image_for_comments( $args, $id_or_email ) {
if( is_object( $id_or_email ) && ! empty( $id_or_email->user_id ) ) {
$img = get_user_meta( $id_or_email->user_id, 'custom_profile_image');
if(!empty($img)&&!empty($img[0])){
$args['url']=esc_url($img[0]);
}
}
return $args;
}
endif;
add_filter( 'get_avatar_data', 'exs_filter_custom_avatar_image_for_comments', 10, 2 );