get_template_directory_uri() . '/images/logo.png', 'width' => 400, 'height' => 100, 'header-text' => false, ); add_theme_support('custom-header', $header); } if (function_exists('add_image_size')) { add_image_size('content', 622, 253, true); add_image_size('loop', 174, 131, true); add_image_size('cp_small', 70, 53, true); } if (function_exists('add_editor_style')) { add_editor_style(); } /***** Register Navigation *****/ if (function_exists('register_nav_menus')) { register_nav_menus(array('main_nav' => __('Main Navigation', 'mh'))); } /***** Register Widget Areas / Sidebars *****/ if (function_exists('register_sidebar')) { register_sidebar(array('name' => __('Sidebar', 'mh'), 'id' => 'sidebar', 'description' => __('Sidebar', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
')); register_sidebars(2, array('name' => __('Posts %d', 'mh'), 'description' => __('Widget area on posts', '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' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
')); register_sidebar(array('name' => __('Footer 2', 'mh'), 'id' => 'footer-2', 'description' => __('Footer widget area', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
')); register_sidebar(array('name' => __('Footer 3', 'mh'), 'id' => 'footer-3', 'description' => __('Footer widget area', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
')); register_sidebar(array('name' => __('Footer 4', 'mh'), 'id' => 'footer-4', 'description' => __('Footer widget area', 'mh'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
')); } /***** Custom Excerpts *****/ function custom_excerpt($text = '') { $raw_excerpt = $text; if ('' == $text) { $options = get_option('mh_options'); $custom_length = empty($options['excerpt_length']) ? '45' : $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 Comment List *****/ 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'); /***** Enable Shortcodes inside Widgets *****/ add_filter('widget_text', 'do_shortcode'); /***** Load JavaScript *****/ if (!function_exists('mh_scripts')) : function mh_scripts() { wp_deregister_script('jquery'); wp_enqueue_script('modernizr', get_template_directory_uri() . '/js/modernizr.js'); wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.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('jquery-powertip', get_template_directory_uri() . '/js/jquery.powertip-1.1.0.min.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'); } endif; add_action('wp_enqueue_scripts', 'mh_scripts'); /***** Theme Translations *****/ load_theme_textdomain('mh', get_template_directory() . '/languages'); /***** Subheading Meta Box *****/ add_action('add_meta_boxes', 'mh_add_meta_boxes'); add_action('save_post', 'mh_save_meta_boxes', 10, 2 ); function mh_add_meta_boxes() { add_meta_box('mh_subheading', __('Subheading', 'mh'), 'mh_subheading_meta_box', 'post', 'normal', 'default'); } function mh_subheading_meta_box() { global $post; wp_nonce_field('mh_meta_box_nonce', 'meta_box_nonce'); echo '

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

    '; } 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; } $meta_data['mh-subheading'] = $_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); } } ?>