' . __extra_excerpt_more_text() . ''; endif; }// Method endif; /** @since 1.0.1 Creates continue reading text */ if(!function_exists('__extra_excerpt_more_text')) : function __extra_excerpt_more_text() { $continue_reading = sprintf( /* translators: %s: Name of current post. */ esc_html__('Read More %s','uikit-starter'), the_title('','',FALSE) ); return $continue_reading; }// Method endif; add_action('edit_category','__hook_category_transient_flusher'); add_action('save_post','__hook_category_transient_flusher'); /** @since 1.0.1 Flush out the transients used in categorized_blog. */ if(!function_exists('__hook_category_transient_flusher')) : function __hook_category_transient_flusher() { if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){return;} // Like, beat it. Dig? delete_transient('uikit_starter_categories'); }// Method endif; add_filter('body_class','__hook_body_class'); /** @since 1.0.1 Filters the list of CSS body class names for the current post or page. @link https://developer.wordpress.org/reference/hooks/body_class/ @param (array) $classes Classes for the body element. @return (array) */ if(function_exists('__hook_body_class') === FALSE) : function __hook_body_class($classes) { /** @description Helps detect if JS is enabled or not. */ $classes[] = 'no-js'; /** @description Adds `singular` to singular pages, and `hfeed` to all other pages. */ $classes[] = is_singular() ? 'singular' : 'hfeed'; /** @description Add a body class if navigation is active. */ if(has_nav_menu('primary')){ $classes[] = 'has-main-navigation'; }// endif if(has_nav_menu('secondary')){ $classes[] = 'has-sub-navigation'; }// endif /** @description Add a body class if there are no footer widgets. */ if(!is_active_sidebar('sidebar-1') && !is_active_sidebar('footerr-1')){ $classes[] = 'no-widgets'; }// endif return $classes; }// Method endif; add_filter('post_class','__hook_post_class',10,3); /** @since 1.0.1 Filters the list of CSS class names for the current post. @link https://developer.wordpress.org/reference/hooks/post_class/ @param (string[]) $classes An array of post class names. @return (string[]) */ if(function_exists('__hook_post_class') === FALSE) : function __hook_post_class($classes,$class,$post_id) { $classes[] = 'uk-article uk-padding'; return $classes; }// Method endif; add_action('wp_head','__hook_wp_head'); /** @since 1.0.1 Add a pingback url auto-discovery header for single posts, pages, or attachments. @link https://developer.wordpress.org/reference/hooks/wp_head/ @return (void) */ if(function_exists('__hook_wp_head') === FALSE) : function __hook_wp_head() { if(is_singular() && pings_open()){ echo ''; }// endif }// Method endif; add_action('wp_footer','__hook_wp_footer'); /** @since 1.0.1 Remove the `no-js` class from body if JS is supported. @link https://developer.wordpress.org/reference/hooks/wp_footer/ @return (void) */ if(function_exists('__hook_wp_footer') === FALSE) : function __hook_wp_footer() { echo ''; }// Method endif; add_filter('wp_get_attachment_image_attributes','__hook_wp_get_attachment_image_attributes',10,3); /** @since 1.0.1 Filters the list of attachment image attributes. @link https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_attributes/ @param (array) $attr Array of attribute values for the image markup, keyed by attribute name. See wp_get_attachment_image(). @param (WP_Post) $attachment Image attachment post. @param (string)|(array) $size Requested size. Image size or array of width and height values(in that order). Default 'thumbnail'. @return (array) */ if(function_exists('__hook_wp_get_attachment_image_attributes') === FALSE) : function __hook_wp_get_attachment_image_attributes($attr,$attachment,$size) { if(isset($attr['class']) && FALSE !== strpos($attr['class'],'custom-logo')){ return $attr; }// endif $width = FALSE; $height = FALSE; if(is_array($size)){ $width = (int) $size[0]; $height = (int) $size[1]; }elseif($attachment && is_object($attachment) && $attachment->ID){ $meta = wp_get_attachment_metadata($attachment->ID); if($meta['width'] && $meta['height']) : $width = (int) $meta['width']; $height = (int) $meta['height']; endif; }// endif if($width && $height){ // Add style. $attr['style'] = isset($attr['style']) ? $attr['style'] : ''; $attr['style'] = 'width:100%; height:' . round(100 * $height / $width,2) . '%;max-width:' . $width . 'px;' . $attr['style']; }// endif return $attr; }// Method endif; add_filter('get_the_archive_title','__hook_get_the_archive_title'); /** @since 1.0.1 Filters the archive title.. @link https://developer.wordpress.org/reference/hooks/get_the_archive_title/ */ if(function_exists('__hook_get_the_archive_title') === FALSE) : function __hook_get_the_archive_title($title) { if(is_category()){ $title = __('Category Archives: ','uikit-starter') . '' . single_term_title('',FALSE) . ''; }elseif(is_tag()){ $title = __('Tag Archives: ','uikit-starter') . '' . single_term_title('',FALSE) . ''; }elseif(is_author()){ $title = __('Author Archives: ','uikit-starter') . '' . get_the_author_meta('display_name') . ''; }elseif(is_year()){ $title = __('Yearly Archives: ','uikit-starter') . '' . get_the_date(_x('Y','yearly archives date format','uikit-starter')) . ''; }elseif(is_month()){ $title = __('Monthly Archives: ','uikit-starter') . '' . get_the_date(_x('F Y','monthly archives date format','uikit-starter')) . ''; }elseif(is_day()){ $title = __('Daily Archives: ','uikit-starter') . '' . get_the_date() . ''; }elseif(is_post_type_archive()){ $title = __('Post Type Archives: ','uikit-starter') . '' . post_type_archive_title('',FALSE) . ''; }elseif(is_tax()){ $tax = get_taxonomy(get_queried_object()->taxonomy); /* translators: %s: Taxonomy singular name. */ $title = sprintf(esc_html__('%s Archives:','uikit-starter'),$tax->labels->singular_name); }else{ $title = __('Archives:','uikit-starter'); }// endif return $title; }// Method endif; add_filter('wp_nav_menu_objects','__hook_wp_nav_menu_objects',10,2); /** @since 1.0.1 Create a nav menu item to be displayed on mobile to navigate from submenu back to the parent. This duplicates each parent nav menu item and makes it the first child of itself. @link https://developer.wordpress.org/reference/hooks/wp_nav_menu_objects/ @param (array) $sorted_menu_items Sorted nav menu items. @param (object) $args Nav menu args. @return (array) Amended nav menu items. */ if(function_exists('__hook_wp_nav_menu_objects') === FALSE) : function __hook_wp_nav_menu_objects($sorted_menu_items,$args) { static $pseudo_id = 0; if(!isset($args->theme_location) || 'menu-1' !== $args->theme_location){ return $sorted_menu_items; }// endif $amended_menu_items = array(); foreach($sorted_menu_items as $nav_menu_item){ $amended_menu_items[] = $nav_menu_item; if(in_array('menu-item-has-children',$nav_menu_item->classes,true)) : $parent_menu_item = clone $nav_menu_item; $parent_menu_item->original_id = $nav_menu_item->ID; $parent_menu_item->ID = --$pseudo_id; $parent_menu_item->db_id = $parent_menu_item->ID; $parent_menu_item->object_id = $parent_menu_item->ID; $parent_menu_item->classes = array('mobile-parent-nav-menu-item'); $parent_menu_item->menu_item_parent = $nav_menu_item->ID; $amended_menu_items[] = $parent_menu_item; endif; }// endforeach return $amended_menu_items; }// Method endif;