Example #1
0
 public function save_meta_boxes($post_id, $post)
 {
     // $post_id and $post are required
     if (empty($post_id) || empty($post)) {
         return;
     }
     // Dont' save meta boxes for revisions or autosaves
     if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
         return;
     }
     // Check the nonce
     if (empty($_POST['dh_meta_box_nonce']) || !wp_verify_nonce($_POST['dh_meta_box_nonce'], 'dh_meta_box_nonce')) {
         return;
     }
     // Check the post being saved == the $post_id to prevent triggering this call for other save_post events
     if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
         return;
     }
     // Check user has permission to edit
     if (!current_user_can('edit_post', $post_id)) {
         return;
     }
     if (isset($_POST['dh_meta'])) {
         $dh_meta = $_POST['dh_meta'];
         if (get_post_format() == 'video') {
             $_dh_video_embed = $dh_meta['_dh_video_embed'];
             if (dh_is_video_support($_dh_video_embed) && $_dh_video_embed != dh_get_post_meta('video_embed_hidden')) {
                 $videoThumbUrl = dh_get_video_thumb_url($_dh_video_embed);
                 if (!empty($videoThumbUrl)) {
                     // add the function above to catch the attachments creation
                     add_action('add_attachment', array(&$this, 'add_video_featured_image'));
                     // load the attachment from the URL
                     media_sideload_image($videoThumbUrl, $post_id, $post_id);
                     // we have the Image now, and the function above will have fired too setting the thumbnail ID in the process, so lets remove the hook so we don't cause any more trouble
                     remove_action('add_attachment', array(&$this, 'add_video_featured_image'));
                 }
             }
         }
         // Process
         foreach ((array) $_POST['dh_meta'] as $key => $val) {
             $val = wp_unslash($val);
             if (is_array($val)) {
                 $option_value = array_filter(array_map('sanitize_text_field', (array) $val));
                 update_post_meta($post_id, $key, $option_value);
             } else {
                 update_post_meta($post_id, $key, wp_kses_post($val));
             }
         }
     }
     do_action('dh_metabox_save', $post_id);
 }
								</div>
							</div>
						</div>
						<?php 
        } elseif (get_post_format() == 'quote') {
            ?>
						<div class="hentry-wrap hentry-wrap-link">
							<div class="entry-content">
								<div class="quote-content">
									<a href="<?php 
            the_permalink();
            ?>
">
										<span>
											<?php 
            echo dh_get_post_meta('quote');
            ?>
										</span>
										<cite><i class="fa fa-quote-left"></i> <?php 
            the_title();
            ?>
</cite>
									</a>
								</div>
							</div>
						</div>
						<?php 
        } else {
            ?>
						<div class="hentry-wrap">
							<?php 
Example #3
0
<?php

/*
Template Name: Full Width 100%
*/
$no_padding = dh_get_post_meta('no_padding');
get_header();
?>
	<div class="content-container<?php 
echo !empty($no_padding) ? ' no-padding' : '';
?>
">
		<div class="container-full">
			<div class="row">
				<div class="col-md-12 main-wrap" data-itemprop="mainContentOfPage" role="main">
					<div class="main-content">
						<?php 
if (have_posts()) {
    ?>
							<?php 
    while (have_posts()) {
        the_post();
        the_content();
    }
    ?>
						<?php 
}
?>
					</div>
				</div>
			</div>
Example #4
0
function dh_post_featured($post_id = '', $post_format = '', $is_shortcode = false, $is_related = false, $entry_featured_class = '', $layout = '')
{
    $post_id = empty($post_id) ? get_the_ID() : $post_id;
    $post_format = empty($post_format) ? get_post_format() : $post_format;
    $thumb_size = !is_singular() || $is_shortcode || $is_related ? 'dh-thumbnail' : 'dh-full';
    if ($layout == 'masonry') {
        $thumb_size = 'dh-full';
    }
    $thumb_size = apply_filters('dh_post_featured_thumbnail_size', $thumb_size, $post_id);
    $featured_class = !empty($post_format) ? ' ' . $post_format . '-featured' : '';
    if ($is_related) {
        if (has_post_thumbnail()) {
            $thumb = get_the_post_thumbnail($post_id, $thumb_size, array('itemprop' => 'image'));
            echo '<div class="entry-featured' . $featured_class . '">';
            echo '<a href="' . get_the_permalink() . '" title="' . esc_attr(get_the_title(get_post_thumbnail_id($post_id))) . '">' . $thumb . '</a>';
            echo '</div>';
        }
    } else {
        if ($post_format == 'gallery') {
            /**
             * script
             * {{
             */
            wp_enqueue_script('vendor-carouFredSel');
            $gallery_ids = explode(',', dh_get_post_meta('gallery'));
            $gallery_ids = array_filter($gallery_ids);
            if (!empty($gallery_ids) && is_array($gallery_ids)) {
                ?>
			<div class="entry-featured<?php 
                echo esc_attr($featured_class);
                echo ' ' . $entry_featured_class;
                ?>
">
				<div class="caroufredsel" data-visible="1" data-responsive="1" data-infinite="1" data-autoplay="1"  data-height="variable">
					<div class="caroufredsel-wrap">
						<ul class="caroufredsel-items">
							<?php 
                foreach ($gallery_ids as $id) {
                    ?>
								<?php 
                    if ($id) {
                        ?>
								<?php 
                        $image = wp_get_attachment_image_src($id, 'dh-full');
                        ?>
								<li class="caroufredsel-item">
									<a href="<?php 
                        echo @$image[0];
                        ?>
" title="<?php 
                        echo get_the_title($id);
                        ?>
" data-rel="magnific-popup">
										<?php 
                        echo wp_get_attachment_image($id, $thumb_size);
                        ?>
									</a>
								</li>
								<?php 
                    }
                    ?>
							<?php 
                }
                ?>
						</ul>
						<a href="#" class="caroufredsel-prev"></a>
						<a href="#" class="caroufredsel-next"></a>
					</div>
				</div>
			</div>
			<?php 
            }
        } elseif ($post_format == 'video') {
            /**
             * script
             * {{
             */
            wp_enqueue_style('mediaelement');
            wp_enqueue_script('mediaelement');
            if (is_single()) {
                $video_args = array();
                if ($mp4 = dh_get_post_meta('video_mp4')) {
                    $video_args['mp4'] = $mp4;
                }
                if ($ogv = dh_get_post_meta('video_ogv')) {
                    $video_args['ogv'] = $ogv;
                }
                if ($webm = dh_get_post_meta('video_webm')) {
                    $video_args['webm'] = $webm;
                }
                $poster = dh_get_post_meta('video_poster');
                $poster_attr = '';
                if (has_post_thumbnail()) {
                    $post_thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $thumb_size);
                    $poster_attr = ' poster="' . esc_url(@$post_thumb[0]) . '"';
                }
                if (!empty($poster)) {
                    $poster_image = wp_get_attachment_image_src($poster, $thumb_size);
                    $poster_attr = ' poster="' . esc_url(@$poster_image[0]) . '"';
                }
                if (!empty($video_args)) {
                    $video = '<div id="video-featured-' . $post_id . '" class="video-embed-wrap"><video controls="controls" ' . $poster_attr . ' preload="0" class="video-embed">';
                    $source = '<source type="%s" src="%s" />';
                    foreach ($video_args as $video_type => $video_src) {
                        $video_type = wp_check_filetype($video_src, wp_get_mime_types());
                        $video .= sprintf($source, $video_type['type'], esc_url($video_src));
                    }
                    $video .= '</video></div>';
                    echo '<div class="entry-featured' . $featured_class . '">';
                    echo dhecho($video);
                    echo '</div>';
                } elseif ($embed = dh_get_post_meta('video_embed')) {
                    if (!empty($embed)) {
                        echo '<div class="entry-featured ' . $post_format . '-featured ' . $entry_featured_class . '">';
                        echo '<div id="video-featured-' . $post_id . '" class="embed-wrap">';
                        echo apply_filters('dh_embed_video', $embed);
                        echo '</div>';
                        echo '</div>';
                    }
                }
            } else {
                if (has_post_thumbnail()) {
                    $thumb = get_the_post_thumbnail($post_id, $thumb_size, array('data-itemprop' => 'image'));
                } else {
                    $thumb = '<img src="' . get_template_directory_uri() . '/assets/images/noo-thumb_700x350.png" alt="' . get_the_title() . '">';
                }
                echo '<div class="entry-featured' . $featured_class . ' ' . $entry_featured_class . '">';
                echo '<a href="' . get_the_permalink() . '" title="' . esc_attr(get_the_title(get_post_thumbnail_id($post_id))) . '">' . $thumb . '<i class="featured-play"></i></a>';
                echo '</div>';
            }
        } elseif ($post_format == 'audio') {
            /**
             * script
             * {{
             */
            wp_enqueue_style('mediaelement');
            wp_enqueue_script('mediaelement');
            $audio_args = array();
            if ($mp3 = dh_get_post_meta('audio_mp3')) {
                $audio_args['mp3'] = $mp3;
            }
            if ($ogg = dh_get_post_meta('audio_ogg')) {
                $audio_args['ogg'] = $ogg;
            }
            if (!empty($audio_args)) {
                $audio = '<div id="audio-featured-' . $post_id . '" class="audio-embed-wrap"><audio class="audio-embed">';
                $source = '<source type="%s" src="%s" />';
                foreach ($audio_args as $type => $audio_src) {
                    $audio_type = wp_check_filetype($audio_src, wp_get_mime_types());
                    $audio .= sprintf($source, $audio_type['type'], esc_url($audio_src));
                }
                $audio .= '</audio></div>';
                echo '<div class="entry-featured' . $featured_class . ' ' . $entry_featured_class . '">';
                echo dhecho($audio);
                echo '</div>';
            }
        } elseif (has_post_thumbnail()) {
            $thumb = get_the_post_thumbnail($post_id, $thumb_size, array('data-itemprop' => 'image'));
            echo '<div class="entry-featured' . $featured_class . ' ' . $entry_featured_class . '">';
            if (!is_singular() || $is_shortcode) {
                echo '<a href="' . get_the_permalink() . '" title="' . esc_attr(get_the_title(get_post_thumbnail_id($post_id))) . '">' . $thumb . '</a>';
            } else {
                echo dhecho($thumb);
            }
            echo '</div>';
        }
    }
    return;
}
Example #5
0
echo get_page_template_slug() === 'page-full-width.php' ? '' : dh_get_theme_option('wide-container', 'fullwidth') . '-container-wrap';
?>
 container-with-header-<?php 
echo esc_attr($header_style);
?>
">
	<?php 
if ($header_style != 'sidebar') {
    dh_get_template('header/' . $header_style . '.php', array('page_heading' => $page_heading, 'header_style' => $header_style, 'menu_transparent' => $menu_transparent, 'logo_url' => $logo_url, 'logo_fixed_url' => $logo_fixed_url, 'logo_mobile_url' => $logo_mobile_url));
}
?>
	<?php 
$heading_menu_anchor = dh_get_post_meta('heading_menu_anchor');
?>
	<?php 
if ($page_heading === 'rev' && ($rev_alias = dh_get_post_meta('rev_alias'))) {
    ?>
	<div<?php 
    echo !empty($heading_menu_anchor) ? ' id ="' . esc_attr($heading_menu_anchor) . '"' : '';
    ?>
 class="main-slider">
		<div class="main-slider-wrap">
			<?php 
    echo do_shortcode('[rev_slider ' . $rev_alias . ']');
    ?>
		</div>
	</div>
	<?php 
}
?>
	<?php 
Example #6
0
echo esc_url($logo_mobile_url);
?>
">
										<meta itemprop="name" content="<?php 
bloginfo('name');
?>
">
									</a>
								</div>
								<nav class="collapse navbar-collapse primary-navbar-collapse" itemtype="<?php 
echo dh_get_protocol();
?>
://schema.org/SiteNavigationElement" itemscope="itemscope" role="navigation">
									<?php 
$page_menu = '';
if (is_page() && ($selected_page_menu = dh_get_post_meta('main_menu'))) {
    $page_menu = $selected_page_menu;
}
if (has_nav_menu('primary') || !empty($page_menu)) {
    wp_nav_menu(array('theme_location' => 'primary', 'container' => false, 'depth' => 3, 'menu' => $page_menu, 'menu_class' => 'nav navbar-nav primary-nav', 'walker' => new DH_Mega_Walker()));
} else {
    echo '<ul class="nav navbar-nav primary-nav"><li><a href="' . home_url('/') . 'wp-admin/nav-menus.php">' . esc_html__('No menu assigned!', 'jakiro') . '</a></li></ul>';
}
?>
								</nav>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="header-search-overlay hide">
Example #7
0
									</div>
								</div>
								<?php 
        }
        ?>
								<div class="row portfolio-summary">
									<div class="col-md-8">
										<?php 
        dh_portfolio_featured(get_the_ID(), '', false, true);
        ?>
									</div>
									<div class="col-md-4">
										<div class="portfolio-meta-wrap">
											<div class="portfolio-meta">
												<?php 
        if ($project_url = dh_get_post_meta('url')) {
            ?>
													<div class="portfolio-link">
														<a target="_blank" href="<?php 
            echo esc_attr($project_url);
            ?>
" class="btn btn-lg btn-primary"><?php 
            echo esc_html('Launch Project', DH_THEME_DOMAIN);
            ?>
</a>
													</div>
												<?php 
        }
        ?>
												<?php 
        if ($excerpt = get_the_excerpt()) {
Example #8
0
            ?>
						<?php 
        }
        ?>
					<?php 
    }
    ?>
				</div>
			</div>
		</div>
	</div>
	<?php 
}
?>
	<?php 
if (dh_get_post_meta('footer_info', get_the_ID(), 1)) {
    ?>
	<footer id="footer" class="footer" role="contentinfo">
		<div class="footer-info">
			<div class="<?php 
    dh_container_class();
    ?>
">
				<div class="row">
					<div class="col-md-12 text-center">
	            		<div class="footer-info-logo">
							<a title="<?php 
    esc_attr(bloginfo('name'));
    ?>
" href="<?php 
    echo esc_url(home_url('/'));
Example #9
0
 public function custom_tab_content()
 {
     global $product, $post;
     $deafult_custom_tab_content = apply_filters('dh_default_custom_tab_content', 'I am custom tab default content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.');
     echo do_shortcode(dh_get_post_meta('custom_tab_content', $product->id, $deafult_custom_tab_content));
 }
 public function custom_columns($columns, $post_id)
 {
     switch ($columns) {
         case 'slider':
             $terms = get_the_terms($post_id, 'dh_slider');
             if (!is_wp_error($terms) && !empty($terms)) {
                 foreach ($terms as $term) {
                     $link = get_edit_term_link($term->term_id, 'dh_slider', 'dh_slide');
                     if (is_wp_error($link)) {
                         return $link;
                     }
                     $term_links[] = '<a href="' . esc_url($link) . '" rel="tag">' . $term->name . '</a>';
                 }
                 echo join(',', $term_links);
             }
             break;
         case 'caption':
             $caption = dh_get_post_meta('caption', $post_id);
             $heading = dh_get_post_meta('heading', $post_id);
             echo '<h2>' . $heading . '</h2><p>' . $caption . '</p>';
             break;
         case 'thumbnail':
             $background_type = dh_get_post_meta('bg_type', $post_id);
             if ($background_type == 'image') {
                 $thumbnail = dh_get_post_meta('bg_image', $post_id);
                 if (!empty($thumbnail)) {
                     echo '<a href="' . get_admin_url() . 'post.php?post=' . $post_id . '&action=edit"><img class="slider-thumb" src="' . wp_get_attachment_url($thumbnail) . '" /></a>';
                 } else {
                     echo '<a href="' . get_admin_url() . 'post.php?post=' . $post_id . '&action=edit"><img class="slider-thumb" src="' . DHINC_ASSETS_URL . '/images/placeholder.png" /></a>' . '<strong><a class="row-title" href="' . get_admin_url() . 'post.php?post=' . $post_id . '&action=edit">' . __('No image added', 'sitesao') . '</a></strong>';
                 }
             } else {
                 $thumbnail = dh_get_post_meta('bg_video_poster', $post_id);
                 if (!empty($thumbnail)) {
                     echo '<a href="' . get_admin_url() . 'post.php?post=' . $post_id . '&action=edit"><img class="slider-thumb" src="' . wp_get_attachment_url($thumbnail) . '" /></a>';
                 } else {
                     echo '<a href="' . get_admin_url() . 'post.php?post=' . $post_id . '&action=edit"><img class="slider-thumb" src="' . DHINC_ASSETS_URL . '/images/placeholder.png" /></a>' . '<strong><a class="row-title" href="' . get_admin_url() . 'post.php?post=' . $post_id . '&action=edit">' . __('No image added', 'sitesao') . '</a></strong>';
                 }
             }
             break;
         default:
             break;
     }
 }
Example #11
0
<div class="col-md-3 sidebar-wrap" role="complementary">
	<div class="main-sidebar">
		<?php 
$main_sidebar = dh_get_post_meta('main_sidebar');
if (!empty($main_sidebar) && is_active_sidebar($main_sidebar)) {
    dynamic_sidebar($main_sidebar);
} else {
    if (defined('WOOCOMMERCE_VERSION') && is_woocommerce()) {
        if (is_active_sidebar('sidebar-shop')) {
            dynamic_sidebar('sidebar-shop');
        }
    } else {
        if (is_active_sidebar('sidebar-main')) {
            dynamic_sidebar('sidebar-main');
        }
    }
}
?>
	</div>
</div>
Example #12
0
            if ($w == '3' || $w == '6' || $w == '8' || $w == '12') {
                echo ' ' . $bgs[$bg];
            }
            ?>
">
			<?php 
        }
        ?>
			<article data-title="<?php 
        echo esc_attr(get_the_title());
        ?>
" data-date="<?php 
        echo esc_attr(get_the_time('YmdHis'));
        ?>
"<?php 
        if ($accent_color = dh_get_post_meta('accent_color', $post->ID)) {
            ?>
 data-accent-color="<?php 
            echo esc_attr($accent_color);
            ?>
"<?php 
        }
        ?>
 id="portfolio-<?php 
        the_ID();
        ?>
" class="<?php 
        echo esc_attr($post_class);
        echo esc_attr($post_class_masonry_size);
        echo esc_attr($post_col);
        echo !empty($cat_class) ? ' ' . implode(' ', $cat_class) : '';
Example #13
0
 class="main-slider">
		<div class="main-slider-wrap">
			<?php 
    echo do_shortcode('[rev_slider ' . $rev_alias . ']');
    ?>
		</div>
	</div>
	<?php 
}
?>
	<?php 
if ($page_heading === 'highlighted_post') {
    ?>
		<?php 
    $cats = dh_get_post_meta('highligh_cat');
    $intro_cats = dh_get_post_meta('highligh_intro_cat');
    dh_highlighted_post($cats, $intro_cats);
    ?>
	<?php 
}
?>
	<?php 
if ($page_heading == 'heading') {
    ?>
		<?php 
    if (!empty($page_heading_background_image_url) && !empty($page_heading_title)) {
        ?>
		<div<?php 
        echo !empty($heading_menu_anchor) ? ' id ="' . esc_attr($heading_menu_anchor) . '"' : '';
        ?>
 class="heading-container heading-resize">