'',
'width' => 300,
'height' => 100,
'flex-width' => true,
'flex-height' => true,
'header-text' => false
);
add_theme_support('custom-header', $header);
load_theme_textdomain('mh-magazine-lite', get_template_directory() . '/languages');
add_theme_support('title-tag');
add_theme_support('automatic-feed-links');
add_theme_support('custom-background');
add_theme_support('post-thumbnails');
add_image_size('content', 620, 264, true);
add_image_size('loop', 174, 131, true);
add_image_size('cp_small', 70, 53, true);
add_editor_style();
register_nav_menu('main_nav', __('Main Navigation', 'mh-magazine-lite'));
}
add_action('after_setup_theme', 'mh_magazine_lite_setup');
/***** Add Backwards Compatibility for Title Tag *****/
if (!function_exists('_wp_render_title_tag')) {
function mh_magazine_lite_render_title() { ?>
__('Sidebar', 'mh-magazine-lite'), 'id' => 'sidebar', 'description' => __('Widget area (sidebar left/right) on single posts, pages and archives', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Home 1', 'mh-magazine-lite'), 'id' => 'home-1', 'description' => __('Widget area on homepage', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Home 2', 'mh-magazine-lite'), 'id' => 'home-2', 'description' => __('Widget area on homepage', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Home 3', 'mh-magazine-lite'), 'id' => 'home-3', 'description' => __('Widget area on homepage', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Home 4', 'mh-magazine-lite'), 'id' => 'home-4', 'description' => __('Widget area on homepage', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Home 5', 'mh-magazine-lite'), 'id' => 'home-5', 'description' => __('Widget area on homepage', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Posts 1', 'mh-magazine-lite'), 'id' => 'posts-1', 'description' => __('Widget area above single post content', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Posts 2', 'mh-magazine-lite'), 'id' => 'posts-2', 'description' => __('Widget area below single post content', 'mh-magazine-lite'), 'before_widget' => '', 'after_widget' => '
', 'before_title' => ''));
register_sidebar(array('name' => __('Footer 1', 'mh-magazine-lite'), 'id' => 'footer-1', 'description' => __('Widget area in footer', 'mh-magazine-lite'), 'before_widget' => '', 'before_title' => ''));
register_sidebar(array('name' => __('Footer 2', 'mh-magazine-lite'), 'id' => 'footer-2', 'description' => __('Widget area in footer', 'mh-magazine-lite'), 'before_widget' => '', 'before_title' => ''));
register_sidebar(array('name' => __('Footer 3', 'mh-magazine-lite'), 'id' => 'footer-3', 'description' => __('Widget area in footer', 'mh-magazine-lite'), 'before_widget' => '', 'before_title' => ''));
register_sidebar(array('name' => __('Footer 4', 'mh-magazine-lite'), 'id' => 'footer-4', 'description' => __('Widget area in footer', 'mh-magazine-lite'), 'before_widget' => '', 'before_title' => ''));
}
}
add_action('widgets_init', 'mh_widgets_init');
/***** Add CSS classes to HTML tag *****/
if (!function_exists('mh_magazine_lite_html_class')) {
function mh_magazine_lite_html_class() {
$mh_magazine_lite_options = mh_magazine_lite_theme_options();
isset($mh_magazine_lite_options['full_bg']) && $mh_magazine_lite_options['full_bg'] == 1 ? $fullbg = ' fullbg' : $fullbg = '';
echo $fullbg;
}
}
add_action('mh_html_class', 'mh_magazine_lite_html_class');
/***** Add CSS classes to body tag *****/
if (!function_exists('mh_magazine_lite_body_class')) {
function mh_magazine_lite_body_class($classes) {
$mh_magazine_lite_options = mh_magazine_lite_theme_options();
$classes[] = 'mh-' . $mh_magazine_lite_options['sb_position'] . '-sb';
return $classes;
}
}
add_filter('body_class', 'mh_magazine_lite_body_class');
/***** Logo / Header Image Fallback *****/
if (!function_exists('mh_logo')) {
function mh_logo() {
$header_img = get_header_image();
echo '' . "\n";
if ($header_img) {
echo '
' . "\n";
} else {
echo '
' . "\n";
}
echo '
' . "\n";
}
}
/***** Page Title Output *****/
if (!function_exists('mh_page_title')) {
function mh_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-magazine-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');
} else {
_e('Archives', 'mh-magazine-lite');
}
} else {
if (is_home()) {
echo get_the_title(get_option('page_for_posts', true));
} elseif (is_404()) {
_e('Page not found (404)', 'mh-magazine-lite');
} elseif (is_search()) {
printf(__('Search Results for %s', 'mh-magazine-lite'), esc_attr(get_search_query()));
} else {
the_title();
}
}
echo '
' . "\n";
}
}
}
add_action('mh_before_page_content', 'mh_page_title');
/***** Subheading on Posts *****/
if (!function_exists('mh_subheading')) {
function mh_subheading() {
global $post;
if (get_post_meta($post->ID, "mh-subheading", true)) {
echo '' . "\n";
echo '' . esc_attr(get_post_meta($post->ID, "mh-subheading", true)) . '
' . "\n";
}
}
}
add_action('mh_post_header', 'mh_subheading');
/***** Featured Image on Posts *****/
if (!function_exists('mh_featured_image')) {
function mh_featured_image() {
global $post;
if (has_post_thumbnail() && !is_attachment()) {
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'content');
echo "\n" . '' . "\n";
echo '
' . "\n";
if (get_post(get_post_thumbnail_id())->post_excerpt) {
echo '
' . wp_kses_post(get_post(get_post_thumbnail_id())->post_excerpt) . '' . "\n";
}
echo '
' . "\n";
}
}
}
/***** Author box *****/
if (!function_exists('mh_author_box')) {
function mh_author_box($author_ID = '') {
$mh_magazine_lite_options = mh_magazine_lite_theme_options();
if (isset($mh_magazine_lite_options['author_box'])) {
if (!$mh_magazine_lite_options['author_box'] && !is_attachment() && get_the_author_meta('description', $author_ID)) {
$author_ID = get_the_author_meta('ID');
$ab_output = true;
} else {
$ab_output = false;
}
} elseif (!is_attachment() && get_the_author_meta('description', $author_ID)) {
$author_ID = get_the_author_meta('ID');
$ab_output = true;
} else {
$ab_output = false;
}
if ($ab_output) {
echo '' . "\n";
echo '' . "\n";
echo '
' . get_avatar($author_ID, 113) . '
' . "\n";
echo '
' . __('About ', 'mh-magazine-lite') . esc_attr(get_the_author_meta('display_name', $author_ID)) . '
' . "\n";
echo '
' . wp_kses_post(get_the_author_meta('description', $author_ID)) . '
' . "\n";
echo '
' . "\n";
echo '' . "\n";
}
}
}
add_action('mh_after_post_content', 'mh_author_box');
/***** Post / Image Navigation *****/
if (!function_exists('mh_postnav')) {
function mh_postnav() {
global $post;
$mh_magazine_lite_options = mh_magazine_lite_theme_options();
if (isset($mh_magazine_lite_options['post_nav']) && $mh_magazine_lite_options['post_nav']) {
$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);
}
echo '' . "\n";
}
}
}
add_action('mh_after_post_content', 'mh_postnav');
/***** Loop Output *****/
if (!function_exists('mh_loop')) {
function mh_loop() {
if (have_posts()) {
while (have_posts()) : the_post();
get_template_part('loop', get_post_format());
endwhile;
mh_pagination();
} else {
get_template_part('content', 'none');
}
}
}
add_action('mh_loop_content', 'mh_loop');
/***** Custom Excerpts *****/
if (!function_exists('mh_magazine_lite_excerpt_length')) {
function mh_magazine_lite_excerpt_length($length) {
$mh_magazine_lite_options = mh_magazine_lite_theme_options();
$excerpt_length = absint($mh_magazine_lite_options['excerpt_length']);
return $excerpt_length;
}
}
add_filter('excerpt_length', 'mh_magazine_lite_excerpt_length', 999);
if (!function_exists('mh_magazine_lite_excerpt_more')) {
function mh_magazine_lite_excerpt_more($more) {
global $post;
$mh_magazine_lite_options = mh_magazine_lite_theme_options();
return ' ' . esc_attr($mh_magazine_lite_options['excerpt_more']) . '';
}
}
add_filter('excerpt_more', 'mh_magazine_lite_excerpt_more');
if (!function_exists('mh_magazine_lite_excerpt_markup')) {
function mh_magazine_lite_excerpt_markup($excerpt) {
$markup = '' . $excerpt . '
';
return $markup;
}
}
add_filter('the_excerpt', 'mh_magazine_lite_excerpt_markup');
/***** Custom Commentlist *****/
if (!function_exists('mh_comments')) {
function mh_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="li-comment-">
'',
'email' => '',
'url' => ''
);
return $fields;
}
}
add_filter('comment_form_default_fields', 'mh_comment_fields');
/***** Pagination *****/
if (!function_exists('mh_pagination')) {
function mh_pagination() {
global $wp_query;
$big = 9999;
echo 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-magazine-lite'), 'next_text' => __('»', 'mh-magazine-lite'), 'total' => $wp_query->max_num_pages));
}
}
if (!function_exists('mh_posts_pagination')) {
function mh_posts_pagination($content) {
if (is_singular() && is_main_query()) {
$content .= wp_link_pages(array('before' => '', 'link_before' => '', 'link_after' => '', 'nextpagelink' => __('»', 'mh-magazine-lite'), 'previouspagelink' => __('«', 'mh-magazine-lite'), 'pagelink' => '%', 'echo' => 0));
}
return $content;
}
}
add_filter('the_content', 'mh_posts_pagination', 1);
/***** Add Featured Image Size to Media Gallery Selection *****/
if (!function_exists('custom_image_size_choose')) {
function custom_image_size_choose($sizes) {
$custom_sizes = array('content' => 'Featured Image');
return array_merge($sizes, $custom_sizes);
}
}
add_filter('image_size_names_choose', 'custom_image_size_choose');
/***** Add CSS3 Media Queries Support for older versions of IE *****/
function mh_magazine_lite_media_queries() {
echo '' . "\n";
}
add_action('wp_head', 'mh_magazine_lite_media_queries');
/***** Include Functions *****/
if (is_admin()) {
require_once('admin/admin.php');
}
require_once('includes/mh-options.php');
require_once('includes/mh-widgets.php');
?>