'; // 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; /* ------------------------------------------------------------------------------------------------ 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' ) || is_page_template( 'page-templates/template-portfolio.php' ) ) ? '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() ) { $post_type = 'post'; $home_url = home_url(); } elseif ( is_post_type_archive() ) { $post_type = get_post_type(); $home_url = get_post_type_archive_link( $post_type ); } else if ( is_page_template( 'page-templates/template-portfolio.php' ) ) { $post_type = 'jetpack-portfolio'; $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 might want to filter this to make sure it points to the correct URL as well (or maybe remove it altogether). $home_url = apply_filters( 'eksell_filter_home_url', $home_url ); ?>
ID ); } add_action( 'eksell_preview_end', 'eksell_maybe_output_post_meta' ); endif; if ( ! function_exists( 'eksell_get_post_meta' ) ) : function eksell_get_post_meta( $post_id ) { // Get our post type. $post_type = get_post_type( $post_id ); // Get the list of the post types that support post meta, and only proceed if the current post type is supported. $post_type_has_post_meta = false; $post_types_with_post_meta = Eksell_Customizer::get_post_types_with_post_meta(); foreach ( $post_types_with_post_meta as $post_type_with_post_meta => $data ) { if ( $post_type == $post_type_with_post_meta ) { $post_type_has_post_meta = true; break; } } if ( ! $post_type_has_post_meta ) return; // Get the default post meta for this post type. $post_meta_default = isset( $post_types_with_post_meta[$post_type]['default'] ) ? $post_types_with_post_meta[$post_type]['default'] : array(); // Get the post meta for this post type from the Customizer setting. $post_meta = get_theme_mod( 'eksell_post_meta_' . $post_type, $post_meta_default ); // If we have post meta, sort it. if ( $post_meta && ! in_array( 'empty', $post_meta ) ) { // Set the output order of the post meta. $post_meta_order = array( 'date', 'author', 'categories', 'tags', 'comments', 'edit-link' ); /** * Filter for the output order of the post meta. * * Allows child themes to modify the output order of the post meta. Any post meta items * added with the eksell_post_meta_items filter will not be affected by this sorting, * so you'll have to provide your own sorting when you filter the post meta items. * * @param array $post_meta_order Order of the post meta items. * @param int $post_id ID of the post. */ $post_meta_order = apply_filters( 'eksell_post_meta_order', $post_meta_order, $post_id ); // Store any custom post meta items in a separate array, so we can append them after sorting. $post_meta_custom = array_diff( $post_meta, $post_meta_order ); // Loop over the intended order, and sort $post_meta_reordered accordingly. $post_meta_reordered = array(); foreach ( $post_meta_order as $i => $post_meta_name ) { $original_i = array_search( $post_meta_name, $post_meta ); if ( $original_i === false ) continue; $post_meta_reordered[$i] = $post_meta[$original_i]; } // Reassign the reordered post meta with custom post meta items appended, and update the indexes. $post_meta = array_values( array_merge( $post_meta_reordered, $post_meta_custom ) ); } /** * Filter the post meta. * * Allows child themes to add, remove and modify post meta items. * * @param array $post_meta Post meta items to include in the post meta. * @param int $post_id ID of the post. */ $post_meta = apply_filters( 'eksell_post_meta_items', $post_meta, $post_id ); // If the post meta setting has the value 'empty' at this point, it's explicitly empty and the default post meta shouldn't be output. if ( ! $post_meta || ( $post_meta && in_array( 'empty', $post_meta ) ) ) return; /** * Filter for the post meta CSS classes. * * Allows child themes to filter the classes on the post meta wrapper elements. * * @param array $classes CSS classes of the element. * @param int $post_id ID of the post. * @param array $post_meta Post meta items set for the post type. */ $post_meta_wrapper_classes = apply_filters( 'eksell_post_meta_wrapper_classes', array( 'post-meta-wrapper' ), $post_id, $post_meta ); $post_meta_classes = apply_filters( 'eksell_post_meta_classes', array( 'post-meta' ), $post_id, $post_meta ); // Convert the class arrays to strings for output. $post_meta_wrapper_classes_str = implode( ' ', $post_meta_wrapper_classes ); $post_meta_classes_str = implode( ' ', $post_meta_classes ); // Enable the $eksell_has_meta variable to be modified in actions. global $eksell_has_meta; // Default it to false, to make sure we don't output an empty container. $eksell_has_meta = false; global $post; $post = get_post( $post_id ); setup_postdata( $post ); // Record out output. ob_start(); ?>