function mh_themes_wrapper_end() { ?> </div> <?php $options = mh_theme_options(); ?> <?php if ($options['sidebars'] != 'no') { ?> <aside class="mh-sidebar <?php mh_sb_class(); ?> "> <?php dynamic_sidebar('woocommerce'); ?> </aside> <?php } ?> </div> <?php mh_second_sb(); ?> </div> <?php }
function mh_share_buttons_bottom() { $options = mh_theme_options(); if ($options['social_buttons'] == 'both_social' || $options['social_buttons'] == 'bottom_social') { mh_share_buttons_content(); } }
function mh_infinite_scroll_render() { $options = mh_theme_options(); while (have_posts()) { the_post(); get_template_part('content', 'loop-' . $options['loop_layout']); } }
function mh_remove_teaser_text() { global $post, $more; $options = mh_theme_options(); if ($options['teaser_text'] == 'enable') { if (strstr($post->post_content, '<!--more-->') && !has_excerpt()) { $content = get_the_content('', true); } else { $content = get_the_content(); } } else { $content = get_the_content(); } $content = '<div class="brodtekst" itemprop="articleBody">' . $content . '</div>'; echo apply_filters('the_content', $content); }
function v2_coauthors_box($author_ID = '') { $options = mh_theme_options(); if ($options['authorbox_layout'] != 'disable' && !is_attachment() || is_page_template('page-authors.php')) { $name = get_the_author_meta('display_name', $author_ID); $website = get_the_author_meta('user_url', $author_ID); $facebook = get_the_author_meta('facebook', $author_ID); $twitter = get_the_author_meta('twitter', $author_ID); $googleplus = get_the_author_meta('googleplus', $author_ID); $youtube = get_the_author_meta('youtube', $author_ID); echo '<section class="author-box">' . "\n"; echo '<div class="author-box-wrap clearfix">' . "\n"; echo '<div class="author-box-avatar">' . get_avatar($author_ID, 113) . '</div>' . "\n"; echo '<h5 class="author-box-name">' . sprintf(__('About %s', 'mh'), esc_attr($name)) . '<span class="author-box-postcount"> (<a href="' . esc_url(get_author_posts_url($author_ID)) . '" title="' . sprintf(__('More articles written by %s', 'mh'), esc_attr($name)) . '">' . sprintf(__('%s Articles', 'mh'), count_user_posts($author_ID)) . '</a>)</span></h5>' . "\n"; if (get_the_author_meta('description', $author_ID)) { echo '<div class="author-box-desc">' . wp_kses_post(get_the_author_meta('description', $author_ID)) . '</div>' . "\n"; } else { echo '<div class="author-box-desc">' . __('The author has not yet added any personal or biographical info to his author profile.', 'mh') . '</div>' . "\n"; } echo '</div>' . "\n"; if ($options['author_contact'] == 'enable') { if ($website || $facebook || $twitter || $googleplus || $youtube) { echo '<div class="author-box-contact">'; echo '<span class="author-box-contact-start">' . __('Contact:', 'mh') . ' </span>'; if ($website) { echo '<a class="author-box-website" href="' . esc_url($website) . '" title="' . sprintf(__('Visit the website of %s', 'mh'), esc_attr($name)) . '" target="_blank">' . __('Website', 'mh') . '</a>'; } if ($facebook) { echo '<a class="author-box-facebook" href="' . esc_url($facebook) . '" title="' . sprintf(__('Follow %s on Facebook', 'mh'), esc_attr($name)) . '" target="_blank">' . __('Facebook', 'mh') . '</a>'; } if ($twitter) { echo '<a class="author-box-twitter" href="' . esc_url($twitter) . '" title="' . sprintf(__('Follow %s on Twitter', 'mh'), esc_attr($name)) . '" target="_blank">' . __('Twitter', 'mh') . '</a>'; } if ($googleplus) { echo '<a class="author-box-googleplus" href="' . esc_url($googleplus) . '" title="' . sprintf(__('Follow %s on Google+', 'mh'), esc_attr($name)) . '" target="_blank">' . __('Google+', 'mh') . '</a>'; } if ($youtube) { echo '<a class="author-box-youtube" href="' . esc_url($youtube) . '" title="' . sprintf(__('Follow %s on YouTube', 'mh'), esc_attr($name)) . '" target="_blank">' . __('YouTube', 'mh') . '</a>'; } echo '</div>' . "\n"; } } echo '</section>' . "\n"; } }
function mh_fonts_css() { $options = mh_theme_options(); if ($options['google_webfonts'] == 'enable') { $font_css = array('armata' => '"Armata", sans-serif', 'arvo' => '"Arvo", serif', 'asap' => '"Asap", sans-serif', 'bree_serif' => '"Bree Serif", serif', 'droid_sans' => '"Droid Sans", sans-serif', 'droid_sans_mono' => '"Droid Sans Mono", sans-serif', 'droid_serif' => '"Droid Serif", serif', 'fjalla_one' => '"Fjalla One", sans-serif', 'lato' => '"Lato", sans-serif', 'lora' => '"Lora", serif', 'merriweather' => '"Merriweather", serif', 'merriweather_sans' => '"Merriweather Sans", sans-serif', 'monda' => '"Monda", sans-serif', 'nobile' => '"Nobile", sans-serif', 'noto_sans' => '"Noto Sans", sans-serif', 'noto_serif' => '"Noto Serif", serif', 'open_sans' => '"Open Sans", sans-serif', 'oswald' => '"Oswald", sans-serif', 'pt_sans' => '"PT Sans", sans-serif', 'pt_serif' => '"PT Serif", serif', 'raleway' => '"Raleway", sans-serif', 'roboto' => 'Roboto', 'roboto_condensed' => '"Roboto Condensed", sans-serif', 'ubuntu' => '"Ubuntu", sans-serif', 'yanone_kaffeesatz' => '"Yanone Kaffeesatz", sans-serif'); if (!empty($options['font_size']) && $options['font_size'] != '14' || $options['font_heading'] != 'open_sans' || $options['font_body'] != 'open_sans') { echo '<style type="text/css">' . "\n"; if (!empty($options['font_size']) && $options['font_size'] != '14') { echo '.entry { font-size: ' . $options['font_size'] . 'px; font-size: ' . $options['font_size'] / 16 . 'rem; }' . "\n"; } if ($options['font_heading'] != 'open_sans') { echo 'h1, h2, h3, h4, h5, h6, .cp-widget-title { font-family: ' . $font_css[$options['font_heading']] . '; }' . "\n"; } if ($options['font_body'] != 'open_sans') { echo 'body { font-family: ' . $font_css[$options['font_body']] . '; }' . "\n"; } echo '</style>' . "\n"; } } }
function mh_advertising($content) { if (is_singular('post') && is_main_query()) { global $post; $options = mh_theme_options(); $ad_position = 1; if ($options['teaser_text'] == 'enable') { if (strstr($post->post_content, '<!--more-->') && !has_excerpt()) { $ad_position = 2; } } $paragraphs = explode("<p", $content); $counter = 0; foreach ($paragraphs as $paragraph) { if ($counter == 0) { $content = $paragraph; } if ($counter > 0) { $content .= '<p' . $paragraph; } if ($counter == $ad_position) { if (!get_post_meta($post->ID, 'mh-no-ad', true)) { if (get_post_meta($post->ID, 'mh-alt-ad', true)) { $adcode = '<div class="content-ad">' . do_shortcode(get_post_meta($post->ID, 'mh-alt-ad', true)) . '</div>' . "\n"; } else { $adcode = !empty($options['content_ad']) ? '<div class="content-ad">' . do_shortcode($options['content_ad']) . '</div>' . "\n" : ''; } $content .= $adcode; } } $counter++; } return $content; } else { return $content; } }
<?php $paged = get_query_var('paged') ? get_query_var('paged') : 1; query_posts('cat=408,410&paged=' . $paged); ?> <?php $options = mh_theme_options(); get_header(); ?> <div class="mh-wrapper clearfix"> <div class="mh-main clearfix"> <div id="main-content" class="mh-loop mh-content"><?php mh_before_page_content(); if (category_description()) { ?> <section class="cat-desc"> <?php echo category_description(); ?> </section><?php } if (have_posts()) { while (have_posts()) { the_post(); get_template_part('content', 'loop-' . $options['loop_layout']); } mh_pagination(); } else { get_template_part('content', 'none'); }
function mh_sb_css($sb_pos = '', $float = '') { $options = mh_theme_options(); if ($options['sb_position'] == 'left') { $sb_pos = 'sb-left'; } else { $sb_pos = 'sb-right'; } echo $sb_pos; }
function mh_breadcrumb() { if (!is_home() && !is_front_page()) { global $post; $options = mh_theme_options(); if ($options['breadcrumbs'] == 'enable') { $delimiter = ' <span class="bc-delimiter">»</span> '; $before_link = '<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">'; $before_title = '<span itemprop="title">'; $close_span = '</span>'; echo '<nav class="breadcrumb">' . $before_link . '<a href="' . esc_url(home_url()) . '" itemprop="url">' . $before_title . __('Home', 'mh') . $close_span . '</a>' . $close_span . $delimiter; if (is_single() && get_post_type() == 'post' && !is_attachment()) { $category = get_the_category(); $category_id = $category[0]->cat_ID; $parent_id = $category[0]->category_parent; $parents = get_category_parents($parent_id, true, $delimiter); if ($parent_id != 0) { echo $parents; } echo $before_link . '<a href="' . esc_url(get_category_link($category_id)) . '" itemprop="url">' . $before_title . esc_attr($category[0]->name) . $close_span . '</a>' . $close_span . $delimiter; echo get_the_title(); } elseif (is_attachment()) { echo __('Media', 'mh') . $delimiter; echo get_the_title(); } elseif (is_page() && !$post->post_parent) { echo get_the_title(); } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = $before_link . '<a href="' . get_permalink($page->ID) . '" itemprop="url">' . $before_title . get_the_title($page->ID) . $close_span . '</a>' . $close_span; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $bc) { } echo $bc . $delimiter; echo get_the_title(); } elseif (is_category() || is_tax()) { $term = get_queried_object(); $term_id = $term->term_id; if (is_category()) { $term_id = get_category($term_id); $parents = get_category($term_id->parent); if ($term_id->parent != 0) { echo get_category_parents($parents, true, $delimiter); } } elseif (is_tax()) { $taxonomy = get_taxonomy($term->taxonomy); echo $taxonomy->labels->name . $delimiter; } echo single_cat_title('', false); } elseif (is_tag()) { echo single_term_title('', false); } elseif (is_author()) { global $author; $user_info = get_userdata($author); echo __('Authors', 'mh') . $delimiter . esc_attr($user_info->display_name); } elseif (is_404()) { echo __('Page not found (404)', 'mh'); } elseif (is_search()) { echo __('Search', 'mh') . $delimiter . get_search_query(); } elseif (is_date()) { $arc_year = get_the_time('Y'); $arc_month = get_the_time('F'); $arc_month_num = get_the_time('m'); $arc_day = get_the_time('d'); $arc_day_full = get_the_time('l'); $url_year = get_year_link($arc_year); $url_month = get_month_link($arc_year, $arc_month_num); if (is_day()) { echo $before_link . '<a href="' . $url_year . '" title="' . __('Yearly Archives', 'mh') . '" itemprop="url">' . $before_title . $arc_year . $close_span . '</a>' . $close_span . $delimiter; echo $before_link . '<a href="' . $url_month . '" title="' . __('Monthly Archives', 'mh') . '" itemprop="url">' . $before_title . $arc_month . $close_span . '</a>' . $close_span . $delimiter . $arc_day . ' (' . $arc_day_full . ')'; } elseif (is_month()) { echo $before_link . '<a href="' . $url_year . '" title="' . __('Yearly Archives', 'mh') . '" itemprop="url">' . $before_title . $arc_year . $close_span . '</a>' . $close_span . $delimiter . $arc_month; } elseif (is_year()) { echo $arc_year; } } elseif (is_single() && get_post_type() != 'post' || is_post_type_archive(get_post_type())) { $post_type_data = get_post_type_object(get_post_type()); $post_type_name = $post_type_data->labels->name; if (is_single() && get_post_type() != 'post') { $post_type_slug = $post_type_data->rewrite['slug']; $permalinks = get_option('permalink_structure'); if ($permalinks == '') { echo $before_link . '<a href="' . esc_url(home_url()) . '?post_type=' . $post_type_slug . get_post_type() . '" itemprop="url">' . $before_title . $post_type_name . $close_span . '</a>' . $close_span . $delimiter; } else { echo $before_link . '<a href="' . esc_url(home_url()) . '/' . $post_type_slug . '/" itemprop="url">' . $before_title . $post_type_name . $close_span . '</a>' . $close_span . $delimiter; } echo get_the_title(); } elseif (is_post_type_archive(get_post_type())) { echo $post_type_name; } } echo '</nav>' . "\n"; } } }
function mh_custom_css() { $options = mh_theme_options(); if ($options['color_bg_header'] != '#ffffff' || $options['color_bg_inner'] != '#ffffff' || $options['color_1'] != '#2a2a2a' || $options['color_2'] != '#e64946' || $options['color_text_general'] != '#000000' || $options['color_text_1'] != '#ffffff' || $options['color_text_2'] != '#ffffff' || $options['color_text_meta'] != '#979797' || $options['color_links'] != '#000000' || $options['color_links_hover'] != '#e64946' || $options['custom_css']) { ?> <style type="text/css"> <?php if ($options['color_bg_header'] != '#ffffff') { ?> .header-wrap { background: <?php echo $options['color_bg_header']; ?> } <?php } ?> <?php if ($options['color_bg_inner'] != '#ffffff') { ?> .mh-wrapper { background: <?php echo $options['color_bg_inner']; ?> } <?php } ?> <?php if ($options['color_1'] != '#2a2a2a') { ?> .main-nav, .header-nav .menu .menu-item:hover > .sub-menu, .main-nav .menu .menu-item:hover > .sub-menu, .slide-caption, .spotlight, .carousel-layout1, footer, .loop-layout2 .loop-wrap .meta, .loop-layout3 .loop-wrap .meta, input[type=submit]:hover, #cancel-comment-reply-link:hover, .copyright, #infinite-handle span:hover { background: <?php echo $options['color_1']; ?> ; } .slicknav_menu, .slicknav_nav ul { border-color: <?php echo $options['color_1']; ?> ; } .copyright, .copyright a { color: #fff; } <?php } ?> <?php if ($options['color_2'] != '#e64946') { ?> .ticker-title, .header-nav .menu-item:hover, .main-nav li:hover, .footer-nav, .footer-nav ul li:hover > ul, .slicknav_menu, .slicknav_btn, .slicknav_nav .slicknav_item:hover, .slicknav_nav a:hover, .slider-layout2 .flex-control-paging li a.flex-active, .flex-control-paging li a.flex-active, .sl-caption, .subheading, .pt-layout1 .page-title, .wt-layout2 .widget-title, .wt-layout2 .footer-widget-title, .carousel-layout1 .caption, .page-numbers:hover, .current, .pagelink, a:hover .pagelink, input[type=submit], #cancel-comment-reply-link, .post-tags li:hover, .tagcloud a:hover, .sb-widget .tagcloud a:hover, .footer-widget .tagcloud a:hover, #infinite-handle span { background: <?php echo $options['color_2']; ?> ; } .slide-caption, .mh-mobile .slide-caption, [id*='carousel-'], .wt-layout1 .widget-title, .wt-layout1 .footer-widget-title, .wt-layout3 .widget-title, .wt-layout3 .footer-widget-title, .ab-layout1 .author-box, .cat-desc, textarea:hover, input[type=text]:hover, input[type=email]:hover, input[type=tel]:hover, input[type=url]:hover, blockquote { border-color: <?php echo $options['color_2']; ?> ; } .dropcap, .carousel-layout2 .caption { color: <?php echo $options['color_2']; ?> ; } <?php } ?> <?php if ($options['color_text_general'] != '#000000') { ?> body, .mh-content h1, .pt-layout2 .mh-content .page-title, .entry h1, .entry h2, .entry h3, .entry h4, .entry h5 .entry h6, .wp-caption .wp-caption-text, .post-thumbnail .wp-caption-text { color: <?php echo $options['color_text_general']; ?> ; } <?php } ?> <?php if ($options['color_text_1'] != '#ffffff') { ?> .main-nav li a, footer, .footer-widget-title, .spotlight, .sl-title, .spotlight .mh-excerpt a, .slide-title, .slide-caption, .slide-caption .mh-excerpt a, .caption, .copyright, .copyright a, #infinite-handle span:hover { color: <?php echo $options['color_text_1']; ?> ; } <?php } ?> <?php if ($options['color_text_2'] != '#ffffff') { ?> .header-nav a:hover, .header-nav li:hover > a, .main-nav a:hover, .main-nav li:hover > a, .ticker-title, .subheading, .pt-layout1 .mh-content .page-title, .caption, .carousel-layout1 .caption, .sl-caption, input[type=submit], .footer-nav li a, .slicknav_nav a, .slicknav_nav a:hover, .slicknav_nav .slicknav_item:hover, .slicknav_menu .slicknav_menutxt, .tagcloud a:hover, .sb-widget .tagcloud a:hover, .post-tags a:hover, .page-numbers:hover, .mh-content .current, .pagelink, a:hover .pagelink, #infinite-handle span { color: <?php echo $options['color_text_2']; ?> ; } .slicknav_menu .slicknav_icon-bar { background: <?php echo $options['color_text_2']; ?> ; } <?php } ?> <?php if ($options['color_text_meta'] != '#979797') { ?> .meta, .meta a, .breadcrumb, .breadcrumb a { color: <?php echo $options['color_text_meta']; ?> ; } <?php } ?> <?php if ($options['color_links'] != '#000000') { ?> a, .entry a, .related-title, .carousel-layout2 .carousel-item-title, a .pagelink, .page-numbers { color: <?php echo $options['color_links']; ?> ; } <?php } ?> <?php if ($options['color_links_hover'] != '#e64946') { ?> a:hover, .meta a:hover, .breadcrumb a:hover, .related-title:hover, #ticker a:hover .meta, .slide-title:hover, .sl-title:hover, .carousel-layout2 .carousel-item-title:hover { color: <?php echo $options['color_links_hover']; ?> ; } <?php } ?> <?php if ($options['custom_css']) { echo $options['custom_css']; } ?> </style> <?php } }
function mh_widgets_init() { $options = mh_theme_options(); register_sidebar(array('name' => _x('Header', 'widget area name', 'mh'), 'id' => 'header', 'description' => __('Widget area on top of the site', 'mh'), 'before_widget' => '<div class="sb-widget">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => _x('Sidebar', 'widget area name', 'mh'), 'id' => 'sidebar', 'description' => __('Widget area (sidebar left/right) on single posts, pages and archives', 'mh'), 'before_widget' => '<div id="%1$s" class="sb-widget">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); if ($options['sidebars'] == 'two') { register_sidebar(array('name' => sprintf(_x('Sidebar %d', 'widget area name', 'mh'), 2), 'id' => 'sidebar-2', 'description' => __('Second sidebar on single posts, pages and archives', 'mh'), 'before_widget' => '<div class="sb-widget">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); } register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 1), 'id' => 'home-1', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-1 home-wide">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 2), 'id' => 'home-2', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-2 home-wide">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 3), 'id' => 'home-3', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-3">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 4), 'id' => 'home-4', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-4">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 5), 'id' => 'home-5', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-5 home-wide">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 6), 'id' => 'home-6', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-6">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 7), 'id' => 'home-7', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-7 home-wide">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 8), 'id' => 'home-8', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-8">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 9), 'id' => 'home-9', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-9">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 10), 'id' => 'home-10', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-10">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 11), 'id' => 'home-11', 'description' => __('Widget area on homepage', 'mh'), 'before_widget' => '<div class="sb-widget home-11 home-wide">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); if ($options['sidebars'] == 'two') { register_sidebar(array('name' => sprintf(_x('Home %d', 'widget area name', 'mh'), 12), 'id' => 'home-12', 'description' => __('Sidebar on homepage', 'mh'), 'before_widget' => '<div id="%1$s" class="sb-widget home-12">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); } register_sidebar(array('name' => sprintf(_x('Posts %d', 'widget area name', 'mh'), 1), 'id' => 'posts-1', 'description' => __('Widget area above single post content', 'mh'), 'before_widget' => '<div class="sb-widget posts-1">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Posts %d', 'widget area name', 'mh'), 2), 'id' => 'posts-2', 'description' => __('Widget area below single post content', 'mh'), 'before_widget' => '<div class="sb-widget posts-2">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Pages %d', 'widget area name', 'mh'), 1), 'id' => 'pages-1', 'description' => __('Widget area above single page content', 'mh'), 'before_widget' => '<div class="sb-widget pages-1">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Pages %d', 'widget area name', 'mh'), 2), 'id' => 'pages-2', 'description' => __('Widget area below single page content', 'mh'), 'before_widget' => '<div class="sb-widget pages-2">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); register_sidebar(array('name' => sprintf(_x('Footer %d', 'widget area name', 'mh'), 1), 'id' => 'footer-1', 'description' => __('Widget area in footer', 'mh'), 'before_widget' => '<div class="footer-widget footer-1">', 'after_widget' => '</div>', 'before_title' => '<h6 class="footer-widget-title">', 'after_title' => '</h6>')); register_sidebar(array('name' => sprintf(_x('Footer %d', 'widget area name', 'mh'), 2), 'id' => 'footer-2', 'description' => __('Widget area in footer', 'mh'), 'before_widget' => '<div class="footer-widget footer-2">', 'after_widget' => '</div>', 'before_title' => '<h6 class="footer-widget-title">', 'after_title' => '</h6>')); register_sidebar(array('name' => sprintf(_x('Footer %d', 'widget area name', 'mh'), 3), 'id' => 'footer-3', 'description' => __('Widget area in footer', 'mh'), 'before_widget' => '<div class="footer-widget footer-3">', 'after_widget' => '</div>', 'before_title' => '<h6 class="footer-widget-title">', 'after_title' => '</h6>')); register_sidebar(array('name' => sprintf(_x('Footer %d', 'widget area name', 'mh'), 4), 'id' => 'footer-4', 'description' => __('Widget area in footer', 'mh'), 'before_widget' => '<div class="footer-widget footer-4">', 'after_widget' => '</div>', 'before_title' => '<h6 class="footer-widget-title">', 'after_title' => '</h6>')); register_sidebar(array('name' => _x('Contact', 'widget area name', 'mh'), 'id' => 'contact', 'description' => __('Widget area (sidebar) on contact page template', 'mh'), 'before_widget' => '<div class="sb-widget contact">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); if ($options['sidebars'] == 'two') { register_sidebar(array('name' => sprintf(_x('Contact %d', 'widget area name', 'mh'), 2), 'id' => 'contact-2', 'description' => __('2nd widget area (sidebar) on contact page template', 'mh'), 'before_widget' => '<div class="sb-widget">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>')); } }
/** * Overstyrer mh_featured_image definert i * mh_magazine/includes/mh-post-content.php for å bruke * get_the_post_thumbnail for å få featured videos til å fungere. */ function mh_featured_image() { global $page, $post; $options = mh_theme_options(); if (has_post_thumbnail() && $page == '1' && $options['featured_image'] == 'enable' && !get_post_meta($post->ID, 'mh-no-image', true)) { if ($options['sidebars'] == 'no') { $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'slider'); } else { $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'content'); } if ($options['link_featured_image'] == 'enable') { $att_url_begin = '<a href="' . esc_url(get_attachment_link(get_post_thumbnail_id())) . '">'; $att_url_end = '</a>'; } else { $att_url_begin = ''; $att_url_end = ''; } $caption_text = get_post(get_post_thumbnail_id())->post_excerpt; echo "\n" . '<div class="post-thumbnail">' . "\n"; echo $att_url_begin . get_the_post_thumbnail() . $att_url_end . "\n"; if ($caption_text) { echo '<span class="wp-caption-text">' . wp_kses_post($caption_text) . '</span>' . "\n"; } echo '</div>' . "\n"; } }
function mh_custom_image_size_choose($sizes) { $options = mh_theme_options(); if ($options['sidebars'] == 'no') { $custom_sizes = array('slider' => 'Featured Image (large)', 'content' => 'Featured Image (normal)'); } else { $custom_sizes = array('content' => 'Featured Image'); } return array_merge($sizes, $custom_sizes); }