Example #1
0
 function mars_get_thumbnail_image($post_id)
 {
     global $videotube;
     $post_status = $videotube['submit_status'] ? $videotube['submit_status'] : 'pending';
     if ($post_status == 'publish' && get_post_type($post_id) == 'video') {
         get_video_thumbnail($post_id);
     }
 }
Example #2
0
			<div class="col-lg-7 col-md-8 col-sm-8 white ">
				<div class="row">
					<div class='breadcrumbs'>
						<?php 
        if (function_exists('bcn_display') && !is_front_page()) {
            bcn_display();
        }
        ?>
					</div>
				</div>
				<?php 
        $video = null;
        //check if a video thumbnail exists, if so we won't use it to display as a headline image
        if (function_exists('get_video_thumbnail')) {
            $video = get_video_thumbnail();
        }
        if (!$video) {
            $img_srcset = wp_get_attachment_image_srcset(get_post_thumbnail_id($post->ID), array('newshead', 'large', 'medium', 'thumbnail'));
            $img_sizes = wp_get_attachment_image_sizes(get_post_thumbnail_id($post->ID), 'newshead');
            if (has_post_thumbnail($post->ID)) {
                echo get_the_post_thumbnail($post->ID, 'newshead', array('class' => 'img-responsive'));
                echo wpautop("<p class='news_date'>" . get_post_thumbnail_caption() . "</p>");
            }
        }
        ?>

				<h1><?php 
        the_title();
        ?>
</h1>
Example #3
0
/**
 * Get Video Thumbnail URL
 *
 * @param int $size Optional. Image size. Defaults to 'custom-medium';.
 */
function dp_thumb_url($size = 'custom-medium', $default = '', $post_id = null, $echo = false)
{
    global $post;
    if (!$post_id) {
        $post_id = $post->ID;
    }
    if (!$size) {
        $size == 'custom-medium';
    }
    /* Check if this video has a feature image */
    if (has_post_thumbnail() && ($thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size))) {
        $thumb_url = $thumb[0];
    }
    /* If no feature image, try to get auto thumbnail from video by "Video Thumbnails" plugin */
    if (empty($thumb_url) && function_exists('get_video_thumbnail')) {
        $video_thumbnail = get_video_thumbnail($post_id);
        if (!is_wp_error($video_thumbnail)) {
            $thumb_url = $video_thumbnail;
        }
    }
    /* If this is a video by jplayer, try to get thumbnail from video_posts */
    if (empty($thumb_url) && ($poster = get_post_meta($post_id, 'dp_video_poster', true))) {
        $thumb_url = $poster;
    }
    /* If still no image or is wp error, define default image */
    if (empty($thumb_url) || is_wp_error($thumb_url)) {
        if ($default === false || $default === 0) {
            return false;
        }
        $thumb_url = !empty($default) ? $default : get_template_directory_uri() . '/images/nothumb.png';
    }
    if ($echo) {
        echo $thumb_url;
    } else {
        return $thumb_url;
    }
}
Example #4
0
 /**
  * Ajax callback for resetting a video thumbnail in the post editor
  */
 function ajax_reset_callback()
 {
     global $wpdb;
     // this is how you get access to the database
     $post_id = $_POST['post_id'];
     delete_post_meta($post_id, VIDEO_THUMBNAILS_FIELD);
     $video_thumbnail = get_video_thumbnail($post_id);
     if (is_wp_error($video_thumbnail)) {
         echo $video_thumbnail->get_error_message();
     } else {
         if ($video_thumbnail != null) {
             echo '<img src="' . $video_thumbnail . '" style="max-width:100%;" />';
         } else {
             echo __('No video thumbnail for this post.', 'video-thumbnails');
         }
     }
     die;
 }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $largeitems = intval($instance['largeitems']);
        $mediumitems = intval($instance['mediumitems']);
        $thumbnailitems = intval($instance['thumbnailitems']);
        $listitems = intval($instance['listitems']);
        global $post;
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        echo "<div id='ht-feature-news'>";
        //load manual sticky news stories
        $hc = new Pod('homepage_control');
        $top_slot = $hc->get_field('top_news_story');
        //forumalate grid of news stories and formats
        $totalstories = $largeitems + $mediumitems + $thumbnailitems + $listitems;
        $newsgrid = array();
        for ($i = 1; $i <= $totalstories; $i++) {
            if ($i <= $largeitems) {
                $newsgrid[] = "L";
            } elseif ($i <= $largeitems + $mediumitems) {
                $newsgrid[] = "M";
            } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems) {
                $newsgrid[] = "T";
            } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems + $listitems) {
                $newsgrid[] = "Li";
            }
        }
        $siteurl = site_url();
        //manual override news stories
        //display sticky top news stories
        $num_top_slots = count($top_slot);
        $to_fill = $totalstories - $num_top_slots;
        $k = -1;
        $alreadydone = array();
        if ($num_top_slots > 0) {
            foreach ((array) $top_slot as $slot) {
                $newspod = new Pod('news', $slot['ID']);
                if ($newspod->get_field('post_status') != 'publish') {
                    continue;
                }
                $k++;
                $alreadydone[] = $slot['ID'];
                if (function_exists('get_video_thumbnail')) {
                    $videostill = get_video_thumbnail($slot['ID']);
                }
                $thistitle = govintranetpress_custom_title($slot['post_title']);
                $thisURL = $slot['post_name'];
                if ($newsgrid[$k] == "L") {
                    $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot['ID']), 'newshead');
                    if ($image_uri != "" && $videostill == '') {
                        echo "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                    }
                }
                if ($newsgrid[$k] == "M") {
                    $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot['ID']), 'medium');
                    if ($image_uri != "" && $videostill == '') {
                        echo "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                    }
                }
                if ($newsgrid[$k] == "T") {
                    $image_uri = "<a class='pull-right' href='" . $siteurl . "/news/" . $slot['post_name'] . "/'>" . get_the_post_thumbnail($slot['ID'], 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
                    if ($image_uri != "" && $videostill == '') {
                        $image_url = "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'>" . $image_uri . "</a>";
                    }
                }
                $thisdate = $slot['post_date'];
                $post = get_post($slot['ID']);
                setup_postdata($post);
                $thisexcerpt = get_the_excerpt();
                $thisdate = date("j M Y", strtotime($thisdate));
                echo "<h3 class='noborder'><a class='' href='" . $thisURL . "'>" . $thistitle . "</a></h3>";
                if ($newsgrid[$k] == "Li") {
                    echo "<p><span class='news_date'>" . $thisdate . "";
                    echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></span></p>";
                } else {
                    echo "<p><span class='news_date'>" . $thisdate . "</span></p>";
                }
                if ($newsgrid[$k] == "T") {
                    echo "<div class='media'>" . $image_url;
                }
                echo "<div class='media-body'>";
                if ($newsgrid[$k] != "Li") {
                    echo $thisexcerpt . "<p class='news_date'>";
                    echo "<a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></p>";
                }
                echo "</div>";
                if ($newsgrid[$k] == "T") {
                    echo "</div>";
                }
                echo "<hr class='light' />\n";
            }
        }
        //end of stickies
        //display remaining stories
        $cquery = array('orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'news', 'posts_per_page' => $totalstories, 'meta_query' => array(array('key' => 'news_listing_type', 'value' => 0)));
        $news = new WP_Query($cquery);
        if ($news->post_count == 0) {
            echo "Nothing to show.";
        }
        while ($news->have_posts()) {
            $news->the_post();
            if (in_array($post->ID, $alreadydone)) {
                //don't show if already in stickies
                continue;
            }
            $k++;
            if ($k >= $totalstories) {
                break;
            }
            $thistitle = get_the_title($news->ID);
            $newspod = new Pod('news', $news->ID);
            $newspod->display('title');
            $thisURL = get_permalink($news->ID);
            if ($newsgrid[$k] == "L") {
                $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($news->ID), 'newshead');
                if ($image_uri != "" && $videostill == '') {
                    echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                }
            }
            if ($newsgrid[$k] == "M") {
                $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($news->ID), 'medium');
                if ($image_uri != "" && $videostill == '') {
                    echo "<a href='{$thisURL}'><img class='img' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>";
                }
            }
            if ($newsgrid[$k] == "T") {
                $image_uri = "<a class='pull-right' href='{$thisURL}'>" . get_the_post_thumbnail($news->ID, 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
                if ($image_uri != "" && $videostill == '') {
                    $image_url = "<a href='{$thisURL}'>" . $image_uri . "</a>";
                }
            }
            $thisdate = get_the_date();
            $thisexcerpt = get_the_excerpt();
            $thisdate = date("j M Y", strtotime($thisdate));
            echo "<h3 class='noborder'><a class='' href='" . $thisURL . "'>" . $thistitle . "</a></h3>";
            if ($newsgrid[$k] == "Li") {
                echo "<p><span class='news_date'>" . $thisdate . "";
                echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></span></p>";
            } else {
                echo "<p><span class='news_date'>" . $thisdate . "</span></p>";
            }
            if ($newsgrid[$k] == "T") {
                echo "<div class='media'>" . $image_url;
            }
            echo "<div class='media-body'>";
            if ($newsgrid[$k] != "Li") {
                echo $thisexcerpt . "<p class='news_date'>";
                echo "<a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></p>";
            }
            echo "</div>";
            if ($newsgrid[$k] == "T") {
                echo "</div>";
            }
            echo "<hr class='light' />\n";
        }
        echo "</div>";
        wp_reset_query();
        ?>
		<div class="category-block"><p><strong><a title='More in news' class="small" href="<?php 
        echo $siteurl;
        ?>
/newspage/">More in news</a></strong> <i class='glyphicon glyphicon-chevron-right small'></i></p></div>


<?php 
        echo $after_widget;
    }
Example #6
0
    function create_browser($result, $table, $folder = 'profile', $widget = false, $from_cluster = false, $small = false, $from_npo = true)
    {
        $i = 0;
        foreach ($result->result() as $item) {
            if ($table == 'challenges') {
                $pronoun = 'I';
                $CI =& get_instance();
                $pronoun = $CI->MItems->hasTeammates($item->id);
                $profile = $CI->MItems->getUserByChallenge($item->id)->row();
                if ($profile) {
                    if ($folder == 'profile') {
                        $image_name = $profile->profile_pic;
                        $link_id = $profile->user_id;
                    } else {
                        $link_id = $item->id;
                        if ($item->challenge_video) {
                            $image_name = get_video_thumbnail($item->challenge_video);
                        } else {
                            $image_name = $item->challenge_image;
                        }
                    }
                    ?>
				
				<div class='row join<?php 
                    if ($widget) {
                        echo " widget" . $i;
                    }
                    if ($small) {
                        echo ' smaller';
                    }
                    ?>
' id="join<?php 
                    echo $item->id;
                    ?>
">
					
					<?php 
                    /*if(!($widget || $from_cluster)) : ?>
                    			<img class='watermark' src='<?php echo base_url(); ?>images/glyphs/join.png'>
                    		<? endif; */
                    ?>
					
					<?php 
                    echo $this->displayProfileImage($link_id, $image_name, $folder);
                    ?>
					<div class="float_left copy">
						<?php 
                    echo anchor('challenge/view/' . $item->id, $item->challenge_title, "class='activity orange bold' style='display:inline-block;' target='_parent'");
                    ?>
						<?php 
                    if (!$widget) {
                        ?>
							<?php 
                        if ($CI->session->userdata('user_id') == $item->user_id) {
                            echo anchor('challenge/editor/' . $item->id . '/edit', "&lt;edit&gt;", 'class="browser_button"');
                        }
                        ?>
						<?php 
                    }
                    ?>
						<?php 
                    if ($from_cluster) {
                        ?>
							<a class="deactivate_challenge browser_button" id="deactivate_<?php 
                        echo $item->id;
                        ?>
">&lt;deactivate from cluster&gt;</a>
						<?php 
                    }
                    ?>
						<p class="activity"><?php 
                    echo anchor('user/view/' . $profile->user_id, $profile->first_name . ' ' . $profile->last_name, "target='_parent'");
                    ?>
 will <?php 
                    echo anchor('challenge/view/' . $item->id, $item->challenge_declaration, "target='_parent'");
                    ?>
 if $<?php 
                    echo $item->challenge_goal;
                    ?>
 is raised for <?php 
                    echo anchor('npo/view/' . $item->challenge_npo, $item->name, 'target="_parent"');
                    ?>
</p>
						<?php 
                    if ($widget) {
                        ?>
							<?php 
                        echo anchor('challenge/view/' . $item->id . '/give', '<img class="give_button" src="' . base_url() . 'images/buttons/widget-give.png">', 'target="_blank"');
                        ?>
						<?php 
                    }
                    ?>
						<p class='activity raised_goal'>Raised: $<?php 
                    echo number_format($CI->MItems->amountRaised($item->item_id), 2);
                    ?>
 | Goal: $<?php 
                    echo number_format($item->challenge_goal);
                    ?>
</p>
						<p class="date"><?php 
                    echo date('m.d.Y', strtotime($item->challenge_created));
                    ?>
 at <?php 
                    echo date('H:i', strtotime($item->challenge_created));
                    ?>
</p>					
						<div style='clear:both;'></div>
					</div>
					<div style='clear:both;'></div>
				</div>
				
				
				<?php 
                }
            } elseif ($table == 'clusters') {
                if ($folder == 'profile' && false) {
                    $image_name = $profile->profile_pic;
                    $link_id = $profile->user_id;
                } else {
                    $link_id = $item->theid;
                    $image_name = $item->cluster_image;
                }
                $CI =& get_instance();
                $challenges = $CI->MItems->getChallenge(array('cluster_id' => $item->theid));
                ?>
				<div class='row'>
					
					<img class='watermark' src='<?php 
                echo base_url();
                ?>
images/glyphs/cluster.png'>
					<?php 
                echo $this->displayProfileImage($link_id, $image_name, $folder);
                ?>
					
					<div class="float_left copy">
						<?php 
                echo anchor('cluster/view/' . $item->theid, $item->cluster_title, "class='activity orange bold'");
                ?>
						<p class="activity"><?php 
                echo $item->cluster_blurb;
                ?>
</p>
						<p class='activity raised_goal'>Raised: $0 | Goal: $<?php 
                echo $item->cluster_goal;
                ?>
</p>	
						<?php 
                echo anchor('cluster/joina/' . $item->theid, '<img class="rollover" src="' . base_url() . 'images/buttons/join-browse-off.png" />');
                ?>
						<p class="date"><?php 
                echo date('m.d.Y', strtotime($item->created));
                ?>
 at <?php 
                echo date('H:i', strtotime($item->created));
                ?>
</p>

						<div style='clear:both;'></div>
					</div>
					<div style='clear:both;'></div>
					<?php 
                if ($from_npo) {
                    $this->create_browser($challenges, 'challenges', 'profile', false, false, true);
                }
                ?>
				</div>
				<?php 
            } elseif ($table == 'nposearch') {
                ?>
				<div class='row'>
					
					<img class='watermark' src='<?php 
                echo base_url();
                ?>
images/glyphs/npo.png'>
					
					<div class='profile_image'>
			       		<?php 
                if ($item->logo) {
                    ?>
							<?php 
                    get_item_image('npos', $item->id, $item->logo, 'cropped120', 'picture');
                    ?>
			        	<?php 
                } else {
                    ?>
			        		<?php 
                    display_default_image('npo');
                    ?>
			        	<?php 
                }
                ?>
						<?php 
                echo anchor('npo/view/' . $item->id, '<img class="border" src="' . base_url() . 'images/tout-image-border.png" />');
                ?>
					</div>
					
					<div class="float_left copy">
						<?php 
                echo anchor('npo/view/' . $item->id, $item->name, "class='activity orange bold'");
                ?>
						<p class="activity"><?php 
                echo $item->blurb;
                ?>
</p>

						<div style='clear:both;'></div>
					</div>
					<div style='clear:both;'></div>

				</div>
				<?php 
            } elseif ($table == 'npos') {
                ?>
				<?php 
                if ($i % 4 == 0) {
                    ?>
				<div class="npo_row">
				<?php 
                }
                ?>
				
				<div class="item npo" <?php 
                if ($i % 4 == 3) {
                    echo 'style="margin-right:0px;"';
                }
                ?>
>
			    	<div class='image'>
			       		<?php 
                if ($item->logo) {
                    ?>
							<div class='picture'>
							<?php 
                    get_item_image('npos', $item->id, $item->logo, 'cropped120', 'npologo');
                    ?>
							</div>
			        	<?php 
                } else {
                    ?>
			        		<?php 
                    display_default_image('npo');
                    ?>
			        	<?php 
                }
                ?>
						<?php 
                echo anchor('npo/view/' . $item->id, '<img class="border" src="' . base_url() . 'images/tout-image-border.png" />');
                ?>
					</div>
					<p><?php 
                echo anchor('npo/view/' . $item->id, $item->name, array('class' => 'namelink'));
                ?>
</p>
			   </div>
			
				<?php 
                if ($i % 4 == 3) {
                    ?>
					<div class="clear_both"></div>
				</div>
				<?php 
                }
                ?>

				<?php 
            } elseif ($table == 'people') {
                ?>
				
				<div class='row'>
				
					<img class='watermark' src='<?php 
                echo base_url();
                ?>
images/glyphs/user.png'>
					<?php 
                echo $this->displayProfileImage($item->user_id, $item->profile_pic);
                ?>
					<div class="float_left copy">
						<?php 
                echo anchor('user/view/' . $item->user_id, $item->first_name . ' ' . $item->last_name, "class='activity orange bold'");
                ?>
						<div style='clear:both;'></div>
					</div>
					<div style='clear:both;'></div>
				</div>
				
				
				<?php 
            }
            $i++;
        }
        if ($table == 'npos' && $i % 4 != 0) {
            echo "</div>";
        }
        echo '<div style="clear:both;"></div>';
    }
Example #7
0
    ?>
					<div class="col-lg-4 grid-item " >
						<div  class="parq-box">
							<a  href="<?php 
    the_permalink();
    ?>
">
								<?php 
    if (get_video_thumbnail(get_the_ID()) != "") {
        ?>
										<img class="OverlayIcon" src="<?php 
        echo get_stylesheet_directory_uri();
        ?>
/img/play-button.png"/>
										<img class="img-responsive" src="<?php 
        echo get_video_thumbnail(get_the_ID());
        ?>
" />
								
								<?php 
    } else {
        the_post_thumbnail('full', array('class' => 'img-responsive parq-img'));
    }
    ?>
							</a>
							<div class="parq-info">
								<a href="<?php 
    the_permalink();
    ?>
"><span class="parq-title"> <?php 
    the_title();
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $largeitems = intval($instance['largeitems']);
     $mediumitems = intval($instance['mediumitems']);
     $thumbnailitems = intval($instance['thumbnailitems']);
     $listitems = intval($instance['listitems']);
     $showexcerpt = $instance['showexcerpt'];
     $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_pin_stories";
     $top_slot = get_option($acf_key);
     $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_exclude_stories";
     $exclude = get_option($acf_key);
     global $post;
     $removenews = get_transient('cached_removenews');
     if (!$removenews || !is_array($removenews)) {
         //process expired news
         $tzone = get_option('timezone_string');
         date_default_timezone_set($tzone);
         $tdate = date('Ymd');
         $oldnews = query_posts(array('post_type' => 'news', 'meta_query' => array(array('key' => 'news_expiry_date', 'value' => $tdate, 'compare' => '<='))));
         if (count($oldnews) > 0) {
             foreach ($oldnews as $old) {
                 if ($tdate == date('Ymd', strtotime(get_post_meta($old->ID, 'news_expiry_date', true)))) {
                     // if expiry today, check the time
                     if (date('H:i:s', strtotime(get_post_meta($old->ID, 'news_expiry_time', true))) > date('H:i:s')) {
                         continue;
                     }
                 }
                 $expiryaction = get_post_meta($old->ID, 'news_expiry_action', true);
                 if ($expiryaction == 'Revert to draft status') {
                     $my_post = array();
                     $my_post['ID'] = $old->ID;
                     $my_post['post_status'] = 'draft';
                     wp_update_post($my_post);
                     delete_post_meta($old->ID, 'news_expiry_date');
                     delete_post_meta($old->ID, 'news_expiry_time');
                     delete_post_meta($old->ID, 'news_expiry_action');
                     delete_post_meta($old->ID, 'news_auto_expiry');
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($old->ID);
                     }
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($my_post);
                     }
                 }
                 if ($expiryaction == 'Change to regular news') {
                     set_post_format($old->ID, '');
                     delete_post_meta($old->ID, 'news_expiry_date');
                     delete_post_meta($old->ID, 'news_expiry_time');
                     delete_post_meta($old->ID, 'news_expiry_action');
                     delete_post_meta($old->ID, 'news_auto_expiry');
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($old->ID);
                     }
                 }
                 if ($expiryaction == 'Move to trash') {
                     $my_post = array();
                     $my_post['ID'] = $old->ID;
                     $my_post['post_status'] = 'trash';
                     delete_post_meta($old->ID, 'news_expiry_date');
                     delete_post_meta($old->ID, 'news_expiry_time');
                     delete_post_meta($old->ID, 'news_expiry_action');
                     delete_post_meta($old->ID, 'news_auto_expiry');
                     wp_update_post($my_post);
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($old->ID);
                     }
                     if (function_exists('wp_cache_post_change')) {
                         wp_cache_post_change($my_post);
                     }
                 }
             }
         }
         wp_reset_query();
     }
     echo $before_widget;
     if ($title) {
         echo $before_title;
         echo $title;
         echo $after_title;
     }
     echo '<div id="ht-feature-news">';
     //load manual sticky news stories
     //	$home = get_page_by_path('/home/',OBJECT,'page');
     //$top_slot =  get_post_meta($home->ID,'top_news_stories');
     //forumalate grid of news stories and formats
     $totalstories = $largeitems + $mediumitems + $thumbnailitems + $listitems;
     $newsgrid = array();
     for ($i = 1; $i <= $totalstories; $i++) {
         if ($i <= $largeitems) {
             $newsgrid[] = "L";
         } elseif ($i <= $largeitems + $mediumitems) {
             $newsgrid[] = "M";
         } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems) {
             $newsgrid[] = "T";
         } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems + $listitems) {
             $newsgrid[] = "Li";
         }
     }
     $siteurl = site_url();
     //manual override news stories
     //display sticky top news stories
     $num_top_slots = count($top_slot);
     $to_fill = $totalstories - $num_top_slots;
     $k = -1;
     $alreadydone = array();
     if ($num_top_slots > 0) {
         foreach ((array) $top_slot as $thisslot) {
             if (!$thisslot) {
                 continue;
             }
             $slot = get_post($thisslot);
             if ($slot->post_status != 'publish') {
                 continue;
             }
             $k++;
             $alreadydone[] = $slot->ID;
             if (function_exists('get_video_thumbnail')) {
                 $videostill = get_video_thumbnail($slot->ID);
             }
             $thistitle = $slot->post_title;
             $thisURL = get_permalink($slot->ID);
             $video = 0;
             if (has_post_format('video', $slot->ID)) {
                 $video = apply_filters('the_content', get_post_meta($slot->ID, 'news_video_url', true));
             }
             if ($newsgrid[$k] == "L") {
                 $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot->ID), 'newshead');
                 if ($video) {
                     echo $video;
                 } elseif ($image_uri != "") {
                     echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot->post_title) . "' /></a>";
                 }
             }
             if ($newsgrid[$k] == "M") {
                 $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot->ID), 'newsmedium');
                 if ($image_uri != "") {
                     echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot->post_title) . "' /></a>";
                 }
             }
             if ($newsgrid[$k] == "T") {
                 $image_uri = "<a class='pull-right' href='" . $thisURL . "'>" . get_the_post_thumbnail($slot->ID, 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
                 if ($image_uri != "") {
                     $image_url = $image_uri;
                 }
             }
             $thisdate = $slot->post_date;
             $post = get_post($slot->ID);
             setup_postdata($post);
             $thisexcerpt = get_the_excerpt();
             $thisdate = date("j M Y", strtotime($thisdate));
             $ext_icon = '';
             if (get_post_format($slot->ID) == 'link') {
                 $ext_icon = "<span class='dashicons dashicons-migrate'></span> ";
             }
             if ($newsgrid[$k] == "T") {
                 echo "<div class='media'>" . $image_url;
             }
             echo "<div class='media-body'>";
             echo "<h3 class='noborder'>" . $ext_icon . "<a href='" . $thisURL . "'>" . $thistitle . "</a>" . $ext_icon . "</h3>";
             if ($newsgrid[$k] == "Li") {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date("j M Y");
                 comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                 echo '</span> ';
                 echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></span></p>";
             } else {
                 if ($showexcerpt == 'on') {
                     echo "<p>";
                     echo '<span class="listglyph">' . get_the_date("j M Y");
                     comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                     echo '</span> ';
                     echo "</p>";
                     echo $thisexcerpt;
                     echo "<p class='news_date'><a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></p>";
                 } else {
                     echo "<p>";
                     echo '<span class="listglyph">' . get_the_date("j M Y");
                     comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                     echo '</span> ';
                     echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></span></p>";
                 }
             }
             echo "</div>";
             if ($newsgrid[$k] == "T") {
                 echo "</div>";
             }
             echo "<hr class='light' />\n";
         }
     }
     //end of stickies
     //display remaining stories
     $cquery = array('post_type' => 'news', 'posts_per_page' => $totalstories, 'post__not_in' => $exclude, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-status'), "operator" => "NOT IN")));
     $news = new WP_Query($cquery);
     if ($news->post_count == 0) {
         echo "Nothing to show.";
     }
     global $post;
     while ($news->have_posts()) {
         $news->the_post();
         $theid = get_the_id();
         if (in_array($theid, $alreadydone)) {
             //don't show if already in stickies
             continue;
         }
         $k++;
         if ($k >= $totalstories) {
             break;
         }
         $thistitle = get_the_title($theid);
         $thisURL = get_permalink($theid);
         $video = 0;
         if (has_post_format('video', $theid)) {
             $video = apply_filters('the_content', get_post_meta($theid, 'news_video_url', true));
         }
         if ($newsgrid[$k] == "L") {
             $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($theid), 'newshead');
             if ($video) {
                 echo $video;
             } elseif ($image_uri != "") {
                 echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($post->post_title) . "' /></a>";
             }
         }
         if ($newsgrid[$k] == "M") {
             $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($theid), 'newsmedium');
             if ($image_uri != "") {
                 echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($post->post_title) . "' /></a>";
             }
         }
         if ($newsgrid[$k] == "T") {
             $image_uri = "<a class='pull-right' href='{$thisURL}'>" . get_the_post_thumbnail($theid, 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>";
             if ($image_uri != "") {
                 $image_url = $image_uri;
             }
         }
         $thisdate = get_the_date("j M Y");
         $thisexcerpt = get_the_excerpt();
         $ext_icon = '';
         if ($newsgrid[$k] == "T") {
             echo "<div class='media'>" . $image_url;
         }
         echo "<div class='media-body feature-news-" . strtolower($newsgrid[$k]) . "'>";
         if (get_post_format($theid) == 'link') {
             $ext_icon = "<i class='dashicons dashicons-migrate'></i> ";
         }
         echo "<h3 class='noborder'><a href='" . $thisURL . "'>" . $thistitle . "</a> " . $ext_icon . "</h3>";
         if ($newsgrid[$k] == "Li") {
             echo "<p>";
             echo '<span class="listglyph">' . get_the_date("j M Y");
             comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
             echo '</span> ';
             echo "</p>";
         } else {
             if ($showexcerpt == 'on') {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date("j M Y");
                 comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                 echo '</span> ';
                 echo "</p>";
                 echo $thisexcerpt;
                 echo "<p class='news_date'><a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></p>";
             } else {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date("j M Y");
                 comments_number('', ' <span class="dashicons dashicons-admin-comments"></span> 1 comment', ' <span class="dashicons dashicons-admin-comments"></span> % comments');
                 echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Full story <span class='dashicons dashicons-arrow-right-alt2'></span></a></span></p>";
             }
         }
         echo "</div>";
         if ($newsgrid[$k] == "T") {
             echo "</div>";
         }
         echo "<hr class='light' />\n";
     }
     wp_reset_query();
     $landingpage = get_option('options_module_news_page');
     if (!$landingpage) {
         $landingpage_link_text = 'news';
         $landingpage = site_url() . '/newspage/';
     } else {
         $landingpage_link_text = get_the_title($landingpage[0]);
         $landingpage = get_permalink($landingpage[0]);
     }
     echo '<p><strong><a title="' . $landingpage_link_text . '" class="small" href="' . $landingpage . '">' . $landingpage_link_text . '</a></strong> <span class="dashicons dashicons-arrow-right-alt2"></span></p>';
     echo "<div class='clearfix'></div>";
     echo "</div>";
     echo $after_widget;
 }
Example #9
0
function video_thumbnails_past_callback()
{
    global $wpdb;
    // this is how you get access to the database
    $post_id = $_POST['post_id'];
    echo get_the_title($post_id) . ' - ';
    $video_thumbnail = get_video_thumbnail($post_id);
    if (is_wp_error($video_thumbnail)) {
        echo $video_thumbnail->get_error_message();
    } else {
        if ($video_thumbnail != null) {
            echo '<span style="color:green">&#10004;</span> Success!';
        } else {
            echo '<span style="color:red">&#10006;</span> Couldn\'t find a video thumbnail for this post.';
        }
    }
    die;
}
Example #10
0
</span><p><?php 
    echo __('RECOMMENDATION', 'sundance');
    ?>
</p></div>
		  </div>
</span>
	<?php 
}
?>
	<div class="masonary_flex">
		<?php 
$images = get_attached_media('image', $post->ID);
foreach ($images as $img) {
    $img_src = wp_get_attachment_image_src($img->ID, 'medium');
    $vid_thumb = wp_get_attachment_image_src($img->ID, 'full');
    if ($vid_thumb[0] != get_video_thumbnail()) {
        ?>
							<div>
							<img  class="" src="<?php 
        echo $img_src[0];
        ?>
" alt="" />
							</div>
				  <?php 
    }
}
?>
	</div>
	<div class="container sp-page">
		<div class="col-lg-10 col-lg-offset-1">
				<div class="col-lg-8 col-sm-7">
	public static function show_child_pages( $atts ) {
		// Store image size details in case we need to output Video Thumbnails, etc. which may be external files
		$img_sizes = get_intermediate_image_sizes();
		$img_sizes[] = 'full'; // allow "virtual" image size ...
		
		$default_atts = apply_filters( 'ccchildpages_defaults' , array(
			'id'			=> get_the_ID(),
			'cols'			=> '',
			'depth'			=> '1',
			'exclude'		=> '',
			'exclude_tree'	=> '',
			'skin'			=> 'simple',
			'class'			=> '',
			'orderby'		=> 'menu_order',
			'order'			=> 'ASC',
			'link_titles'	=> 'false',
			'title_link_class' => 'ccpage_title_link',
			'hide_more'		=> 'false',
			'hide_excerpt'	=> 'false',
			'truncate_excerpt'	=> 'true',
			'list'			=> 'false',
			'link_thumbs'	=> 'false',
			'thumbs'		=> 'false',
			'more'			=> __('Read more ...', 'cc-child-pages'),
			'link'			=> '',
			'siblings'		=> 'false',
			'words'			=> 55,
		));

		$a = shortcode_atts( $default_atts, $atts );
		
		$a = apply_filters( 'ccchildpages_attributes', $a);
				
		// If we are displaying siblings, set starting point to page parent and add current page to exclude list
		if ( strtolower(trim($a['siblings'])) == 'true' ) {
			$a['id'] = wp_get_post_parent_id( get_the_ID() ) ? wp_get_post_parent_id( get_the_ID() ) : 0;
			
			if ( $a['exclude'] != '' ) $a['exclude'] .= ',';
			
			$a['exclude'] .= get_the_ID();
		}

		$depth = intval($a['depth']);
		
		if ( strtolower(trim($a['list'])) != 'true' && $a['cols'] == '' ) $a['cols']='3';
		
		switch ( $a['cols'] ) {
			case '4':
				$class = 'fourcol';
				$cols = 4;
				break;
			case '3':
				$class = 'threecol';
				$cols = 3;
				break;
			case '2':
				$class = 'twocol';
				$cols = 2;
				break;
			case '1':
				$class = 'onecol';
				$cols = 1;
				break;
			default:
				$class = '';
				$cols = 1;
		}
		
		switch ( $a['skin'] ) {
			case 'red':
				$skin = 'ccred';
				break;
			case 'green':
				$skin = 'ccgreen';
				break;
			case 'blue':
				$skin = 'ccblue';
				break;
			default:
				$skin = 'simple';
		}
		
		if ( strtolower(trim($a['list'])) == 'true' ) {
			$list = TRUE;
		}
		else {
			$list = FALSE;
		}
		
		if ( strtolower(trim($a['truncate_excerpt'])) == 'true' ) {
			$truncate_excerpt = TRUE;
		}
		else {
			$truncate_excerpt = FALSE;
		}
		
		if ( strtolower(trim($a['link_titles'])) == 'true' ) {
			$link_titles = TRUE;
			$title_link_class = trim($a['title_link_class']);
		}
		else {
			$link_titles = FALSE;
		}
		
		if ( strtolower(trim($a['hide_more'])) == 'true' ) {
			$hide_more = TRUE;
		}
		else {
			$hide_more = FALSE;
		}
		
		if ( strtolower(trim($a['hide_excerpt'])) == 'true' ) {
			$hide_excerpt = TRUE;
		}
		else {
			$hide_excerpt = FALSE;
		}
		
		if ( $a['order'] == 'ASC' ) {
			$order = 'ASC';
		}
		else {
			$order = 'DESC';
		}

		switch ( $a['orderby'] ) {
			case 'post_id':
			case 'id':
			case 'ID':
				$orderby = 'ID';
				break;
			case 'post_author':
			case 'author':
				if ( $list ) {
					$orderby = 'post_author';
				}
				else {
					$orderby = 'author';
				}
				break;
			case 'post_date':
			case 'date':
				if ( $list ) {
					$orderby = 'post_date';
				}
				else {
					$orderby = 'date';
				}
				break;
			case 'post_modified':
			case 'modified':
				if ( $list ) {
					$orderby = 'post_modified';
				}
				else {
					$orderby = 'modified';
				}
				break;
			case 'post_title':
			case 'title':
				if ( $list ) {
					$orderby = 'post_title';
				}
				else {
					$orderby = 'title';
				}
				break;
			case 'post_name':
			case 'name':
			case 'slug':
				if ( $list ) {
					$orderby = 'post_name';
				}
				else {
					$orderby = 'name';
				}
				break;
			default:
				$orderby = 'menu_order';
		}

		
		if ( strtolower(trim($a['link_thumbs'])) == 'true' ) {
			$link_thumbs = TRUE;
		}
		else {
			$link_thumbs = FALSE;
		}
		
		if ( strtolower(trim($a['thumbs'])) == 'true' ) {
			$thumbs = 'medium';
		}
		else if ( strtolower(trim($a['thumbs'])) == 'false' ) {
			$thumbs = FALSE;
		}
		else {
			$thumbs = strtolower(trim($a['thumbs']));
			
			if ( ! in_array( $thumbs, $img_sizes ) ) $thumbs = 'medium';
		}
		
		$more = esc_html(trim($a['more']));
		
		// if class is specified, substitue value for skin class
		if ( $a['class'] != '' ) $skin = trim(esc_html($a['class']));
		
		$outer_template = str_replace( '{{class}}', $class, apply_filters('ccchildpages_outer_template','<div class="ccchildpages {{class}} {{skin}} ccclearfix">{{ccchildpages}}</div>', $a) );
		$outer_template = str_replace( '{{skin}}', $skin, $outer_template );
		
		$inner_template = apply_filters('ccchildpages_inner_template','<div class="ccchildpage {{page_class}}"><h3{{title_class}}>{{title}}</h3>{{thumbnail}}{{excerpt}}{{more}}</div>', $a);
				
//		$return_html = '<div class="ccchildpages ' . $class .' ' . $skin . ' ccclearfix">';
		
		$page_id = $a['id'];

		if ( $list ) {	
			$args = array(
				'title_li'		=> '',
				'child_of'		=> $page_id,
				'echo'			=> 0,
				'depth'			=> $depth,
				'exclude'		=> $a['exclude'],
				'sort_order'	=> $order,
				'sort_column'	=> $orderby
			);
			
			$post_type = get_post_type( $page_id );
			$args['post_type'] = $post_type;
			
			$args = apply_filters('ccchildpages_list_pages_args', $args, $a);
		
			$page_count = 0;		

			$return_html = '<ul class="ccchildpages_list ccclearfix">';
						
			$page_list = trim(wp_list_pages( $args ));
			
			if ( $page_list == '' ) return '';
			
			$return_html .= $page_list;
			
			$return_html .= '</ul>';
			
		}
		else {
			$return_html = '';
			
			$posts_array = explode(',', $page_id); // Allow for comma separated lists of IDs
			$post_count = count ($posts_array);
						
			$args = array(
//				'post_type'      => 'page',
//				'post_type'      => $post_type,
				'posts_per_page' => -1,
//				'post_parent'    => $page_id,
				'order'          => $order,
				'orderby'			=> $orderby,
				'post__not_in'		=> explode(',', $a['exclude']),
				'post_status'		=> 'publish'
			);
			
			if ( $post_count > 1 ) {
				// Multiple IDs specified, so set the post_parent__in parameter
				$args['post_parent__in'] = $posts_array;
				
				$post_type_array = array();
				
				// get post_type for each post specified ...
				foreach ( $posts_array as $post_id ) {
					// Get post_type
					$post_type = get_post_type( $post_id );
					
					if ( ! in_array($post_type, $post_type_array) ) $post_type_array[] = $post_type;
				}
				
				$args['post_type'] = $post_type_array;

			}
			else {
				// Single ID specified, so set the post_parent parameter
				$args['post_parent'] = $page_id;
				$args['post_type'] = get_post_type( $page_id );
			}
			
			$args = apply_filters('ccchildpages_query_args', $args, $a);

			$parent = new WP_Query( $args );
		
			if ( ! $parent->have_posts() ) return '';
		
			$page_count = 0;

			while ( $parent->have_posts() ) {
				
				$tmp_html = $inner_template;
			
				$parent->the_post();
				
				$id = get_the_ID();
			
				$page_count++;
			
				if ( $page_count%$cols == 0 && $cols > 1) {
					$page_class = ' cclast';
				}
				else if ( $page_count%$cols == 1 && $cols > 1 ) {
					$page_class = ' ccfirst';
				}
				else {
					$page_class = '';
				}

				if ( $page_count%2 == 0  ) {
					$page_class .= ' cceven';
				}
				else {
					$page_class .= ' ccodd';
				}
				
				$page_class .= ' ccpage-count-' . $page_count;
				$page_class .= ' ccpage-id-' . $id;
				$page_class .= ' ccpage-' . self::the_slug($id);
				
				if ( $a['link'] == '' ) {
					$link = get_permalink($id);
				}
				else {
					$link = $a['link'];
				}
							
				$tmp_html = str_replace('{{page_class}}', $page_class, $tmp_html);
			
				if ( ! $link_titles ) {
					$title_html = get_the_title();
					$title_class = '';
				}
				else {
					$title_html = '<a class="' . $title_link_class . '" href="' . $link . '" title="' . get_the_title() . '">' . get_the_title() . '</a>';
					$title_class = ' class="ccpage_linked_title"';
				}
				$tmp_html = str_replace('{{title}}', $title_html, $tmp_html);
				$tmp_html = str_replace('{{title_class}}', $title_class, $tmp_html);
				
				$thumb_url = '';
				$thumbs_html = '';
				
				if ( $thumbs != FALSE ) {
					
					$thumb_attr = array(
						'class'	=> "cc-child-pages-thumb",
						'alt'	=> get_the_title(),
						'title'	=> get_the_title(),
					);
					
					// Get the thumbnail code ...
					$thumbnail = get_the_post_thumbnail($id, $thumbs, $thumb_attr);
					
					if ( $thumbnail != '' ) {
						// Thumbnail found, so set thumb_url to actual URL of thumbnail
						$tmp_thumb_id = get_post_thumbnail_id($id);
						$tmp_thumb_url_array = wp_get_attachment_image_src($tmp_thumb_id, 'thumbnail-size', true);
						$thumb_url = $tmp_thumb_url_array[0];
					}
					
					// If no thumbnail found, request a "Video Thumbnail" (if plugin installed)
					// to try and force generation of thumbnail
					if ( $thumbnail == '' ) {
						// Check whether Video Thumbnail plugin is installed.
						// If so, call get_video_thumbnail() to make sure that thumnail is generated.
						if ( class_exists('Video_Thumbnails') && function_exists( 'get_video_thumbnail' ) ) {
							// Call get_video_thumbnail to generate video thumbnail
							$video_img = get_video_thumbnail($id);
							
							// If we got a result, display the image
							if ( $video_img != '' ) {
								
								// First, try to pick up the thumbnail in case it has been regenerated (may be the case if automatic featured image is turned on)
								$thumbnail = get_the_post_thumbnail($id, $thumbs, $thumb_attr);
								
								// If thumbnail hasn't been regenerated, use Video Thumbnail (may be the full size image)
								if ( $thumbnail == '' ) {
									
									// First, try and find the attachment ID from the URL
									$attachment_id = self::get_attachment_id($video_img);
									
									$thumb_url = $video_img;
									
									if ( $attachment_id != FALSE ) {
										// Attachment found, get thumbnail
										$thumbnail = wp_get_attachment_image( $attachment_id, $thumbs ) . "\n\n<!-- Thumbnail attachment -->\n\n";
									}
									else {
										$thumbnail .= '<img src="' . $video_img . '" alt="' . get_the_title() . '" />';
									}
								}
							}
						}
						
					}
					
					// If thumbnail is found, display it.
					
					if ( $thumbnail != '' ) {
						if ( $link_thumbs ) {
							$thumbs_html = '<a class="ccpage_linked_thumb" href="' . $link . '" title="' . get_the_title() . '">' . $thumbnail . '</a>';
						}
						else {
							$thumbs_html = $thumbnail;
						}
					}
				}
				
				$tmp_html = str_replace('{{thumbnail}}', $thumbs_html, $tmp_html);
				$tmp_html = str_replace('{{thumbnail_url}}', $thumb_url, $tmp_html);
				
				$page_excerpt = '';

				if ( ! $hide_excerpt ) {
					$words = ( intval($a['words']) > 0 ? intval($a['words']) : 55 );
				
					if ( has_excerpt() ) {
						$page_excerpt = get_the_excerpt();
						if ( str_word_count(strip_tags($page_excerpt) ) > $words && $truncate_excerpt ) $page_excerpt = wp_trim_words( $page_excerpt, $words, '...' );
					}
					else {
						$page_excerpt = do_shortcode( get_the_content() ); // get full page content
						
						if ( str_word_count( wp_trim_words($page_excerpt, $words+10, '') ) > $words ) {
							// If page content is longer than allowed words, 
							$trunc = '...';
						}
						else {
							// If page content is within allowed word count, do not add anything to the end of it
							$trunc = '';
						}
						$page_excerpt = wp_trim_words( $page_excerpt, $words, $trunc );
					}
				
					$page_excerpt = str_replace( '{{page_excerpt}}', $page_excerpt, apply_filters('ccchildpages_excerpt_template', '<div class="ccpages_excerpt">{{page_excerpt}}</div>', $a) );
				}
				
				$tmp_html = str_replace('{{excerpt}}', $page_excerpt, $tmp_html);
				
				$more_html = '';
			
				if ( ! $hide_more ) {
					$more_html = str_replace( '{{more}}', $more, apply_filters('ccchildpages_more_template', '<p class="ccpages_more"><a href="{{link}}" title="{{more}}">{{more}}</a></p>', $a ) );
				}
				
				$tmp_html = str_replace('{{more}}', $more_html, $tmp_html);
				$tmp_html = str_replace('{{link}}', $link, $tmp_html);
				
				$return_html .= $tmp_html;
				
				// Reset global post query
				wp_reset_postdata();
			}
		
		} 	

		$return_html = str_replace('{{ccchildpages}}', $return_html, $outer_template);
		
		$return_html = apply_filters( 'ccchildpages_before_shortcode', '', $a ) . $return_html . apply_filters( 'ccchildpages_after_shortcode', '', $a );
		
//		wp_reset_query(); // Should not be required
		
		return $return_html;
	}
Example #12
0
     } elseif ($postType == "video") {
         set_post_format($postID, 'video');
         //not working
         // if( $key == "video_thumbnail_url" ) {
         //   set_featured_image_from_src( $value, $postID );
         // }
     }
     if (!in_array($key, array('title', 'content', 'cat', 'tag', 'excerpt', 'image'))) {
         add_post_meta($postID, $key, $value, true);
         //Add link thumb as featured image too
         if ($key == "link_thumbnail_url") {
             set_featured_image_from_src($value, $postID);
         }
     }
     if (function_exists('get_video_thumbnail')) {
         get_video_thumbnail($postID);
     }
 }
 // Loop through submitted images and save the first one as featured image
 if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
     array_reverse($_FILES);
     $i = 0;
     foreach ($_FILES as $file => $array) {
         if ($i == 0) {
             $set_feature = 1;
         } else {
             $set_feature = 0;
         }
         $newUpload = insert_attachment($file, $postID, $set_feature);
     }
 }