'; // If dark mode is enabled, return the dark mode fallback image as well, so it can be set to visible in CSS. if ( get_theme_mod( 'eksell_enable_dark_mode_palette', false ) ) { $fallback_image_dark_mode_url = get_template_directory_uri() . '/assets/images/default-fallback-image-dark-mode.png'; $fallback_image .= ''; } return $fallback_image; } endif; /* ----------------------------------------------------------------------------------------------- OUTPUT AND GET THEME SVG Output and get the SVG markup for a icon in the Eksell_SVG_Icons class. @param string $group The group the icon belongs to. @param string $icon The name of the icon in the group array. @param int $width Icon width in pixels. @param int $height Icon height in pixels. --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'eksell_the_theme_svg' ) ) : function eksell_the_theme_svg( $group, $icon, $width = 24, $height = 24 ) { echo eksell_get_theme_svg( $group, $icon, $width, $height ); } endif; if ( ! function_exists( 'eksell_get_theme_svg' ) ) : function eksell_get_theme_svg( $group, $icon, $width = 24, $height = 24 ) { return Eksell_SVG_Icons::get_svg( $group, $icon, $width, $height ); } endif; /* ----------------------------------------------------------------------------------------------- GET SOCIAL LINK SVG Detects the social network from a URL and returns the SVG code for its icon. @param string $uri Social link. @param int $width Icon width in pixels. @param int $height Icon height in pixels. --------------------------------------------------------------------------------------------------- */ function eksell_get_social_link_svg( $uri, $width = 24, $height = 24 ) { return Eksell_SVG_Icons::get_social_link_svg( $uri, $width, $height ); } /* ----------------------------------------------------------------------------------------------- SOCIAL MENU ICONS Displays SVG icons in the social menu. @param string $item_output The menu item's starting HTML output. @param WP_Post $item Menu item data object. @param int $depth Depth of the menu. Used for padding. @param stdClass $args An object of wp_nav_menu() arguments. --------------------------------------------------------------------------------------------------- */ function eksell_nav_menu_social_icons( $item_output, $item, $depth, $args ) { // Change SVG icon inside social menu if there is a supported URL. if ( 'social' === $args->theme_location ) { $svg = eksell_get_social_link_svg( $item->url, 24, 24 ); if ( ! empty( $svg ) ) { $item_output = str_replace( $args->link_before, $svg, $item_output ); } } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'eksell_nav_menu_social_icons', 10, 4 ); /* ----------------------------------------------------------------------------------------------- OUTPUT SOCIAL MENU Output the social menu, if set. @param array $args Arguments for wp_nav_menu(). --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'eksell_the_social_menu' ) ) : function eksell_the_social_menu( $args = array() ) { $social_args = eksell_get_social_menu_args( $args ); if ( has_nav_menu( $social_args['theme_location'] ) ) { wp_nav_menu( $social_args ); } } endif; /* ----------------------------------------------------------------------------------------------- GET SOCIAL MENU WP_NAV_MENU ARGS Return the social menu arguments for wp_nav_menu(). @param array $args Arguments to use in conjunction with the default arguments. --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'eksell_get_social_menu_args' ) ) : function eksell_get_social_menu_args( $args = array() ) { return $args = wp_parse_args( $args, array( 'theme_location' => 'social', 'container' => '', 'container_class' => '', 'menu_class' => 'social-menu reset-list-style social-icons', 'depth' => 1, 'link_before' => '', 'link_after' => '', 'fallback_cb' => '', ) ); } endif; /* ----------------------------------------------------------------------------------------------- IS COMMENT BY POST AUTHOR? Check if the specified comment is written by the author of the post commented on. @param obj $comment The comment object. --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'eksell_is_comment_by_post_author' ) ) : function eksell_is_comment_by_post_author( $comment = null ) { if ( is_object( $comment ) && $comment->user_id > 0 ) { $user = get_userdata( $comment->user_id ); $post = get_post( $comment->comment_post_ID ); if ( ! empty( $user ) && ! empty( $post ) ) { return $comment->user_id === $post->post_author; } } return false; } endif; /* ------------------------------------------------------------------------------------------------ GET POST GRID COLUMN CLASSES Gets the number of columns set in the Customizer, and returns the classes that should be used to set the post grid to the number of columns specified. --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'eksell_get_archive_columns_classes' ) ) : function eksell_get_archive_columns_classes() { $classes = array(); // Get the array holding all of the columns options. $archive_columns_options = Eksell_Customizer::get_archive_columns_options(); // Loop over the array, and class value of each one to the array. foreach ( $archive_columns_options as $setting_name => $setting_data ) { // Get the value of the setting, or the default if none is set. $value = get_theme_mod( $setting_name, $setting_data['default'] ); // Convert the number in the setting (1/2/3/4) to the class names used in our twelve column grid. switch ( $setting_name ) { case 'eksell_post_grid_columns_mobile' : $classes['mobile'] = 'cols-' . ( 12 / $value ); break; case 'eksell_post_grid_columns_tablet_portrait' : $classes['tablet_portrait'] = 'cols-t-' . ( 12 / $value ); break; case 'eksell_post_grid_columns_tablet_landscape' : $classes['tablet_landscape'] = 'cols-tl-' . ( 12 / $value ); break; case 'eksell_post_grid_columns_desktop' : $classes['desktop'] = 'cols-d-' . ( 12 / $value ); break; case 'eksell_post_grid_columns_desktop_large' : $classes['desktop_large'] = 'cols-dl-' . ( 12 / $value ); break; } } // Make the column classes filterable before returning them. return apply_filters( 'eksell_archive_columns_classes', $classes ); } endif; /* ----------------------------------------------------------------------------------------------- OUTPUT ARCHIVE FILTER Output the archive filter beneath the archive header. --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'eksell_the_archive_filter' ) ) : function eksell_the_archive_filter() { // Check if we're showing the filter if ( ! eksell_show_home_filter() ) return; $filter_taxonomy = is_post_type_archive( 'jetpack-portfolio' ) ? 'jetpack-portfolio-type' : 'category'; // Use the eksell_home_filter_get_terms_args filter to modify which taxonomy is used for the filtration. $terms = get_terms( apply_filters( 'eksell_home_filter_get_terms_args', array( 'depth' => 1, 'taxonomy' => $filter_taxonomy, ) ) ); if ( ! $terms ) return; $home_url = ''; $post_type = ''; // Determine the correct home URL to link to. if ( is_home() ) { $home_url = home_url(); $post_type = 'post'; } elseif ( is_post_type_archive() ) { $post_type = get_post_type(); $home_url = get_post_type_archive_link( $post_type ); } // Make the home_url filterable. If you change the taxonomy of the filtration with `eksell_home_filter_get_terms_args`, // you'll probably want to filter this to make sure it points to the correct URL as well. $home_url = apply_filters( 'eksell_filter_home_url', $home_url ); ?>