'; ?> ' : '
'; } do_action( '__after_logo_or_site_title', $logo_or_title ); $html = ob_get_clean(); if ( $echo ) echo apply_filters('hu_logo_title', $html ); else return apply_filters('hu_logo_title', $html ); } } if ( !function_exists( 'hu_do_render_logo_site_tite' ) ) { function hu_do_render_logo_site_tite( $logo_or_title = null, $echo = true ) { //typically, logo_or_title is not provided when partially refreshed from the customizer if ( is_null( $logo_or_title ) || hu_is_ajax() ) { $logo_or_title = hu_get_logo_title(); } // => If no logo is set and !hu_is_checked( 'display-header-title' ), the logo title is empty. if ( !empty( $logo_or_title ) ) { if ( $echo ) { printf( '%2$s', home_url('/'), $logo_or_title, sprintf( '%1$s | %2$s', get_bloginfo('name') , __('Home page', 'hueman') ) ); } else { return sprintf( '%2$s', home_url('/'), $logo_or_title, sprintf( '%1$s | %2$s', get_bloginfo('name') , __('Home page', 'hueman') ) ); } } } } if ( !function_exists( 'hu_render_blog_description' ) ) { function hu_render_blog_description() { echo get_bloginfo( 'description' ); } } /* Retro compat function for child theme users /* ------------------------------------ */ if ( !function_exists( 'hu_site_title' ) ) { function hu_site_title() { return hu_print_logo_or_title( false ); } } /* Page title /* ------------------------------------ */ if ( !function_exists( 'hu_get_page_title' ) ) { function hu_get_page_title() { global $post; $heading = esc_attr( get_post_meta($post->ID,'_heading',true) ); $subheading = esc_attr( get_post_meta($post->ID,'_subheading',true) ); $title = $heading ? $heading: get_the_title(); if($subheading) { $title = $title.' '.$subheading.''; } return $title; } } /* Search Page title /* ------------------------------------ */ if ( !function_exists( 'hu_get_search_title' ) ) { function hu_get_search_title() { global $wp_query; $search_results = $wp_query -> found_posts; $icon = have_posts() ? ' ' : ' '; if ( 1 == $search_results ) { return sprintf( '%1$s%2$s %3$s', $icon, $search_results, __('Search result','hueman') ); } else { return sprintf( '%1$s%2$s %3$s', $icon, $search_results, __('Search results','hueman') ); } } } /* 404 Page title /* ------------------------------------ */ if ( !function_exists( 'hu_get_404_title' ) ) { function hu_get_404_title() { return sprintf('%1$s %2$s ', __('Error 404.','hueman'), __('Page not found!','hueman') ); } } /* Author Page title /* ------------------------------------ */ if ( !function_exists( 'hu_get_author_title' ) ) { function hu_get_author_title() { $author = get_userdata( get_query_var('author') ); if ( !hu_is_checked( 'archive-title-with-icon' ) ) { return $author->display_name; } else { return sprintf('%1$s %2$s ', __('Author:','hueman'), $author->display_name ); } } } /* Term Page title /* @todo => generalize to all taxinomies, including custom ones /* ------------------------------------ */ if ( !function_exists( 'hu_get_term_page_title' ) ) { function hu_get_term_page_title() { if ( is_category() ) { if ( !hu_is_checked( 'archive-title-with-icon' ) ) { $title = single_cat_title('', false); } else { $title = sprintf('%1$s %2$s ', __('Category:','hueman'), single_cat_title('', false) ); } } else if ( is_tag() ) { if ( !hu_is_checked( 'archive-title-with-icon' ) ) { $title = single_tag_title('', false); } else { $title = sprintf('%1$s %2$s ', __('Tagged:','hueman'), single_tag_title('', false) ); } } return $title; } } /* Date archive page title /* ------------------------------------ */ if ( !function_exists( 'hu_get_date_archive_title' ) ) { function hu_get_date_archive_title() { if ( is_day() ) { if ( !hu_is_checked( 'archive-title-with-icon' ) ) { $title = get_the_time('F j, Y'); } else { $title = sprintf('%1$s %2$s ', __('Daily Archive:','hueman'), get_the_time('F j, Y') ); } } else if ( is_month() ) { if ( !hu_is_checked( 'archive-title-with-icon' ) ) { $title = get_the_time('F Y'); } else { $title = sprintf('%1$s %2$s ', __('Monthly Archive:','hueman'), get_the_time('F Y') ); } } else if ( is_year() ) { if ( !hu_is_checked( 'archive-title-with-icon' ) ) { $title = get_the_time('Y'); } else { $title = sprintf('%1$s %2$s ', __('Yearly Archive:','hueman'), get_the_time('Y') ); } } return $title; } } /* Blog title /* ------------------------------------ */ if ( !function_exists( 'hu_blog_title' ) ) { function hu_blog_title() { $heading = wp_kses_post( hu_get_option('blog-heading') ); $heading = $heading ? $heading : get_bloginfo('name'); $subheading = wp_kses_post( hu_get_option('blog-subheading') ); $subheading = $subheading ? $subheading : __('Blog', 'hueman'); return apply_filters( 'hu_blog_title', sprintf('%1$s %2$s', $heading, $subheading ) ); } } /* Related posts /* ------------------------------------ */ function hu_get_related_posts() { wp_reset_postdata(); global $post; // Define shared post arguments $args = array( 'no_found_rows' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'rand', 'post__not_in' => array( $post->ID ), 'posts_per_page' => 3 ); // Related by categories if ( hu_get_option( 'related-posts' ) == 'categories' ) { $cats = get_post_meta( $post->ID, 'related-cat', true ); if ( !$cats ) { $cats = wp_get_post_categories( $post->ID, array( 'fields'=>'ids' ) ); $args['category__in'] = $cats; } else { $args['cat'] = $cats; } } // Related by tags if ( hu_get_option( 'related-posts' ) == 'tags' ) { $tags = get_post_meta($post->ID, 'related-tag', true); if ( !$tags ) { $tags = wp_get_post_tags( $post->ID, array( 'fields'=>'ids') ); $args['tag__in'] = $tags; } else { $args['tag_slug__in'] = explode( ',', $tags ); } if ( !$tags ) { $break = true; } } // if isset( $break ), returns and empty query return !isset( $break ) ? new WP_Query( $args ) : new WP_Query; } /* Get images attached to post /* ------------------------------------ */ if ( !function_exists( 'hu_post_images' ) ) { function hu_post_images( $args=array() ) { global $post; $defaults = array( 'numberposts' => -1, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image', 'post_parent' => $post->ID, 'post_type' => 'attachment', ); $args = wp_parse_args( $args, $defaults ); return get_posts( $args ); } } /* Get featured post ids /* ------------------------------------ */ if ( !function_exists( 'hu_get_featured_post_ids' ) ) { function hu_get_featured_post_ids() { $args = array( 'category' => hu_get_option('featured-category'), 'numberposts' => hu_get_option('featured-posts-count') ); $posts = get_posts($args); if ( !$posts ) return false; foreach ( $posts as $post ) $ids[] = $post->ID; return $ids; } } /* ------------------------------------------------------------------------- * * Placeholder thumbs for preview demo mode /* ------------------------------------------------------------------------- */ /* Echoes the%1$s %3$s
', __('To help you getting started with Hueman, we have published', 'hueman'), esc_url('docs.presscustomizr.com/article/236-first-steps-with-the-hueman-wordpress-theme'), __('a short guide here.', 'hueman') ); ?>