get_template_directory_uri() . '/images/logo.png', 'width' => 300, 'flex-width' => true, 'height' => 100, 'flex-height' => true, 'header-text' => false, ); load_theme_textdomain('mh', get_template_directory() . '/languages'); add_theme_support('automatic-feed-links'); add_theme_support('custom-background'); add_theme_support('custom-header', $header); 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_menus(array('main_nav' => __('Main Navigation', 'mh'))); } add_action('after_setup_theme', 'mh_themes_setup'); /***** Enable Shortcodes inside Widgets *****/ add_filter('widget_text', 'do_shortcode'); /***** Load JavaScript & CSS *****/ function mh_scripts() { wp_deregister_script('jquery'); wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'); wp_enqueue_script('jquery migrate', 'http://code.jquery.com/jquery-migrate-1.2.1.js'); wp_enqueue_script('modernizr', get_template_directory_uri() . '/js/modernizr.js'); wp_enqueue_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery')); wp_enqueue_script('custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery')); wp_enqueue_script('prettyphoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery')); wp_enqueue_style('prettyphoto', get_template_directory_uri() . '/css/prettyPhoto.css'); if (!is_admin()) { if (is_singular() && comments_open() && (get_option('thread_comments') == 1)) wp_enqueue_script('comment-reply'); } } add_action('wp_enqueue_scripts', 'mh_scripts'); /***** Register Widget Areas / Sidebars *****/ function mh_widgets_init() { register_sidebar(array('name' => __('Sidebar', 'mh'), 'id' => 'sidebar', 'description' => __('Sidebar', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Home 1', 'mh'), 'id' => 'home-1', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Home 2', 'mh'), 'id' => 'home-2', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Home 3', 'mh'), 'id' => 'home-3', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Home 4', 'mh'), 'id' => 'home-4', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Home 5', 'mh'), 'id' => 'home-5', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Posts 1', 'mh'), 'id' => 'posts-1', 'description' => __('Widget area above single post content', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Posts 2', 'mh'), 'id' => 'posts-2', 'description' => __('Widget area below single post content', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

')); register_sidebar(array('name' => __('Footer 1', 'mh'), 'id' => 'footer-1', 'description' => __('Footer widget area', 'mh'), 'before_widget' => '', 'before_title' => '')); register_sidebar(array('name' => __('Footer 2', 'mh'), 'id' => 'footer-2', 'description' => __('Footer widget area', 'mh'), 'before_widget' => '', 'before_title' => '')); register_sidebar(array('name' => __('Footer 3', 'mh'), 'id' => 'footer-3', 'description' => __('Footer widget area', 'mh'), 'before_widget' => '', 'before_title' => '')); register_sidebar(array('name' => __('Footer 4', 'mh'), 'id' => 'footer-4', 'description' => __('Footer widget area', 'mh'), 'before_widget' => '', 'before_title' => '')); } add_action('widgets_init', 'mh_widgets_init'); /***** wp_title Output *****/ function mh_wp_title($title, $sep) { global $paged, $page; if (is_feed()) return $title; $title .= get_bloginfo('name'); $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) $title = "$title $sep $site_description"; if ($paged >= 2 || $page >= 2) $title = "$title $sep " . sprintf(__('Page %s', 'mh'), max($paged, $page)); return $title; } add_filter('wp_title', 'mh_wp_title', 10, 2); /***** Page Title Output *****/ function mh_page_title() { echo '

'; if (is_home()) { echo get_the_title(get_option('page_for_posts', true)); } elseif (is_author()) { echo __('Articles by ', 'mh') . get_the_author(); } elseif (is_category()) { echo single_cat_title("", false); } elseif (is_tag()) { echo single_tag_title("", false); } 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_404()) { echo __('Page not found (404)', 'mh'); } echo '

' . "\n"; } /***** Logo / Header Image Fallback *****/ if (!function_exists('mh_logo')) { function mh_logo() { $header_img = get_header_image(); echo '' . "\n"; } } /***** Custom Excerpts *****/ if (!function_exists('custom_excerpt')) { function custom_excerpt($text = '') { $raw_excerpt = $text; if ('' == $text) { global $post; $options = get_option('mh_options'); $custom_length = empty($options['excerpt_length']) ? '35' : $options['excerpt_length']; $text = get_the_content(''); $text = do_shortcode($text); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); $excerpt_length = apply_filters('excerpt_length', $custom_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', 'custom_excerpt'); } /***** Custom Commentlist *****/ if (!function_exists('mh_comments')) { function mh_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?>
  • id="li-comment-">
    comment_author_email, 30); ?> // // $depth, 'max_depth' => $args['max_depth']))) ?>
    comment_approved == '0') : ?>
    '

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

    ', 'email' => '

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

    ', 'url' => '


    ' ); return $fields; } add_filter('comment_form_default_fields', 'comment_fields'); /***** Custom Meta Box *****/ add_action('add_meta_boxes', 'mh_add_meta_boxes'); add_action('save_post', 'mh_save_meta_boxes', 10, 2 ); if (!function_exists('mh_add_meta_boxes')) { function mh_add_meta_boxes() { add_meta_box('mh_post_details', __('Post options', 'mh'), 'mh_post_meta', 'post', 'normal', 'high'); } } if (!function_exists('mh_post_meta')) { function mh_post_meta() { global $post; wp_nonce_field('mh_meta_box_nonce', 'meta_box_nonce'); echo '

    '; echo ''; echo '
    '; echo ''; echo '

    '; } } if (!function_exists('mh_save_meta_boxes')) { function mh_save_meta_boxes($post_id, $post) { if (!isset($_POST['meta_box_nonce']) || !wp_verify_nonce($_POST['meta_box_nonce'], 'mh_meta_box_nonce')) { return $post->ID; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post->ID; } if ('page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post->ID; } } elseif (!current_user_can('edit_post', $post_id)) { return $post->ID; } if ('post' == $_POST['post_type']) { $meta_data['mh-subheading'] = esc_attr($_POST['mh-subheading']); } foreach ($meta_data as $key => $value) { if ($post->post_type == 'revision') return; $value = implode(',', (array)$value); if (get_post_meta($post->ID, $key, FALSE)) { update_post_meta($post->ID, $key, $value); } else { add_post_meta($post->ID, $key, $value); } if (!$value) delete_post_meta($post->ID, $key); } } } /***** Author box *****/ if (!function_exists('mh_author_box')) { function mh_author_box() { $options = get_option('mh_options'); if (get_the_author_meta('description')) { $author = get_the_author(); echo '
    ' . "\n"; echo '
    ' . get_avatar(get_the_author_meta('ID'), 80) . '
    ' . "\n"; echo '
    ' . "\n"; echo '
    ' . __('About ', 'mh') . esc_attr($author) . '
    ' . "\n"; echo '

    '; echo the_author_meta('user_description') . ' '; echo '' . __('More Posts', 'mh') . ''; echo '

    ' . "\n"; echo '
    ' . "\n"; echo '
    ' . "\n"; } } } /***** Post / Image Navigation *****/ if (!function_exists('mh_postnav')) { function mh_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"; } } } /***** Related Posts *****/ if (!function_exists('mh_related')) { function mh_related() { global $post; $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach($tags as $tag) $tag_ids[] = $tag->term_id; $args = array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => 7, 'ignore_sticky_posts' => 1, 'orderby' => 'rand'); $related = new wp_query($args); if ($related->have_posts()) { echo '' . "\n"; wp_reset_postdata(); } } } } /***** 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'), 'next_text' => __('»', 'mh'), 'total' => $wp_query->max_num_pages )); } } /***** Load social scripts *****/ if (!function_exists('mh_social_scripts')) { function mh_social_scripts() { if (is_active_widget('', '', 'mh_facebook')) { global $locale; echo "
    " . "\n"; } } add_action('wp_footer', 'mh_social_scripts'); } /***** Automatically add rel="prettyPhoto" *****/ if (!function_exists('mh_add_prettyphoto')) { function mh_add_prettyphoto($content) { global $post; $pattern = "//i"; $replacement = ''; $content = preg_replace($pattern, $replacement, $content); return $content; } add_filter('the_content', 'mh_add_prettyphoto'); } /***** Custom Dashboard Widget *****/ function mh_info_widget() { ?>

    Thank you very much for downloading MH Magazine lite WordPress theme! If you need help with the theme setup or if you have any questions, please have a look at the:

    If you want your magazine to be fully responsive and if you need more professional options, you can purchase the premium version of MH Magazine. The premium version of MH Magazine has included a lot more features and excellent customer support in german and english language. You can also stay up-to-date by following us on Facebook, Twitter and/or Google+.