= 2 || $page >= 2) $title = "$title $sep " . sprintf(__('Page %s', 'mh-elegance-lite'), max($paged, $page)); return $title; } } add_filter('wp_title', 'mh_elegance_lite_wp_title', 10, 2); /***** Page Title Output *****/ if (!function_exists('mh_elegance_lite_page_title')) { function mh_elegance_lite_page_title() { if (!is_front_page()) { echo '
' . "\n"; echo '

'; if (is_archive()) { if (is_category() || is_tax()) { single_cat_title(); } elseif (is_tag()) { single_tag_title(); } elseif (is_author()) { global $author; $user_info = get_userdata($author); printf(_x('Articles by %s', 'post author', 'mh-elegance-lite'), esc_attr($user_info->display_name)); } elseif (is_day()) { echo get_the_date(); } elseif (is_month()) { echo get_the_date('F Y'); } elseif (is_year()) { echo get_the_date('Y'); } elseif (is_post_type_archive()) { global $post; $post_type = get_post_type_object(get_post_type($post)); echo $post_type->labels->name; } else { _e('Archives', 'mh-elegance-lite'); } } else { if (is_home()) { echo get_the_title(get_option('page_for_posts', true)); } elseif (is_404()) { _e('Page not found (404)', 'mh-elegance-lite'); } elseif (is_search()) { printf(__('Search Results for %s', 'mh-elegance-lite'), esc_attr(get_search_query())); } else { the_title(); } } echo '

' . "\n"; echo '
' . "\n"; } } } add_action('mh_elegance_lite_before_page_content', 'mh_elegance_lite_page_title'); /***** Output Post Meta Data *****/ if (!function_exists('mh_elegance_lite_post_meta')) { function mh_elegance_lite_post_meta() { echo '

' . "\n"; echo sprintf(_x('Date: %s', 'post date', 'mh-elegance-lite'), '' . get_the_date() . '
') . "\n"; echo sprintf(_x('Author: %s', 'post author', 'mh-elegance-lite'), '' . esc_html(get_the_author()) . '
') . "\n"; echo __('Comments:', 'mh-elegance-lite') . ' ' . sprintf(_nx('1 Comment', '%1$s Comments', get_comments_number(), 'comments number', 'mh-elegance-lite'), number_format_i18n(get_comments_number())) . '
' . "\n"; echo sprintf(__('Categories: %s', 'mh-elegance-lite'), '' . get_the_category_list(', ', '') . '') . "\n"; echo '

' . "\n"; } } /***** Featured Image on Posts *****/ if (!function_exists('mh_elegance_lite_featured_image')) { function mh_elegance_lite_featured_image() { global $page, $post; if (has_post_thumbnail() && $page == '1') { $caption_text = get_post(get_post_thumbnail_id())->post_excerpt; echo "\n" . '
' . "\n"; the_post_thumbnail('blog-single'); if ($caption_text) { echo '' . esc_attr($caption_text) . '' . "\n"; } echo '
' . "\n"; } } } /***** Custom Excerpts *****/ if (!function_exists('mh_elegance_lite_trim_excerpt')) { function mh_elegance_lite_trim_excerpt($text = '') { $raw_excerpt = $text; if ('' == $text) { $mh_elegance_lite_options = mh_elegance_lite_theme_options(); $text = get_the_content(''); $text = do_shortcode($text); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); $excerpt_length = apply_filters('excerpt_length', esc_attr($mh_elegance_lite_options['excerpt_length'])); $excerpt_more = apply_filters('excerpt_more', '...'); $text = wp_trim_words($text, $excerpt_length, $excerpt_more); } return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); } } remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'mh_elegance_lite_trim_excerpt'); /***** Pagination *****/ if (!function_exists('mh_elegance_lite_pagination')) { function mh_elegance_lite_pagination() { global $wp_query; $big = 9999; $paginate_links = paginate_links(array( 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'prev_next' => true, 'prev_text' => __('«', 'mh-elegance-lite'), 'next_text' => __('»', 'mh-elegance-lite'), 'total' => $wp_query->max_num_pages) ); if ($paginate_links) { echo ''; } } } /***** Pagination for paginated Posts *****/ if (!function_exists('mh_elegance_lite_posts_pagination')) { function mh_elegance_lite_posts_pagination($content) { if (is_singular() && is_main_query()) { $content .= wp_link_pages(array('before' => '', 'link_before' => '', 'link_after' => '', 'nextpagelink' => __('»', 'mh-vibrancy'), 'previouspagelink' => __('«', 'mh-vibrancy'), 'pagelink' => '%', 'echo' => 0)); } return $content; } } add_filter('the_content', 'mh_elegance_lite_posts_pagination', 1); /***** Post / Image Navigation *****/ if (!function_exists('mh_elegance_lite_postnav')) { function mh_elegance_lite_postnav() { global $post; $parent_post = get_post($post->post_parent); $attachment = is_attachment(); $previous = ($attachment) ? $parent_post : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) return; if ($attachment) { $attachments = get_children(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $parent_post->ID)); $count = count($attachments); } if ($attachment && $count == 1) { $permalink = get_permalink($parent_post); echo '' . "\n"; } elseif (!$attachment || $attachment && $count > 1) { echo '' . "\n"; } } } /***** Custom Commentlist *****/ if (!function_exists('mh_elegance_lite_comments')) { function mh_elegance_lite_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?>
  • id="li-comment-">
    comment_author_email, 70); ?> | | $depth, 'max_depth' => $args['max_depth']))) ?>
    comment_approved == '0') : ?>
    '

    ' . ($req ? '*' : '') . '

    ', 'email' => '

    ' . ($req ? '*' : '' ) . '

    ', 'url' => '


    ' ); return $fields; } } add_filter('comment_form_default_fields', 'mh_elegance_lite_comment_fields'); /***** Logo / Header Image Fallback *****/ if (!function_exists('mh_elegance_lite_logo')) { function mh_elegance_lite_logo() { $header_img = get_header_image(); $header_title = get_bloginfo('name'); $header_desc = get_bloginfo('description'); if ($header_img || display_header_text()) { echo '' . "\n"; } } } /***** Load Social Scripts *****/ if (!function_exists('mh_elegance_lite_social_scripts')) { function mh_elegance_lite_social_scripts() { if (is_active_widget('', '', 'mh_elegance_lite_facebook_widget')) { global $locale; echo "
    " . "\n"; } } } add_action('wp_footer', 'mh_elegance_lite_social_scripts'); /***** Add CSS3 Media Queries Support for older versions of IE *****/ function mh_elegance_lite_ie_media_queries() { echo '' . "\n"; } add_action('wp_head', 'mh_elegance_lite_ie_media_queries'); ?>