示例#1
0
        }
        ?>
					</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>
				<?php 
        $article_date = get_the_date();
        $mainid = $post->ID;
        $article_date = date(get_option('date_format'), strtotime($article_date));
        ?>
				<?php 
        echo the_date(get_option('date_format'), '<p class="news_date">', '</p>');
示例#2
0
 
<?php 
if (has_post_thumbnail()) {
    $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'original');
    ?>

	<div id="imagehader_container" class="csl">
		<div id="featured_image">
			<section id="image_header" class="header custom_header imageheader"  > 
 				<img src='<?php 
    echo $image['0'];
    ?>
' alt='' />
				<?php 
    if (get_post_thumbnail_caption() != "") {
        echo get_post_thumbnail_caption();
    }
    if (get_post_thumbnail_description() != "") {
        echo get_post_thumbnail_description();
    }
    ?>

			</section>
		</div>
	</div>
	<?php 
}
?>
 

            echo get_attachment_link(get_post_thumbnail_id());
            ?>
">

			<?php 
            echo the_post_thumbnail('full', array('class' => 'featured-image'));
            ?>

		</a>
	
		<span class="single-post-header-media-caption-container">
	
			<span class="single-post-header-media-caption-container-inner">
	
				<?php 
            echo wpautop(get_post_thumbnail_caption());
            ?>
	
			</span>
	
		</span> <!-- /.single-post-header-media-caption-container -->

	</div> <!-- /.single-post-header-media-container -->


<?php 
        } else {
            ?>

	<?php 
            // Do nothing!
示例#4
0
 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);
     $acf_key = "widget_" . $this->id_base . "-" . $this->number . "_news_listing_news_type";
     $newstypes = get_option($acf_key);
     if (!$title) {
         $title = "no_title_" . $id;
     }
     $moretitle = $instance['moretitle'];
     global $post;
     $removenews = get_transient('cached_removenews');
     if (!$removenews || !is_array($removenews)) {
         set_transient('cached_removenews', "wait", 60 * 3);
         //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 && $title != "no_title_" . $id) {
         echo $before_title;
         echo $title;
         echo $after_title;
     }
     echo '<div id="ht-feature-news">';
     //formulate 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") {
                 if ($video) {
                     echo $video;
                 } elseif (has_post_thumbnail($post->ID)) {
                     $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');
                     echo "<a href='{$thisURL}'>" . get_the_post_thumbnail($post->ID, 'newshead', array('class' => 'img-responsive')) . "</a>";
                     echo wpautop("<p class='news_date'>" . get_post_thumbnail_caption() . "</p>");
                 }
             }
             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(get_option('date_format'), 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(get_option('date_format'));
                 echo '</span> ';
                 echo " <span class='badge'>Featured</span>";
                 if (get_comments_number()) {
                     echo "<a href='" . $thisURL . "#comments'>";
                     printf(_n('<span class="badge">1 comment</span>', '<span class="badge">%d comments</span>', get_comments_number(), 'govintranet'), get_comments_number());
                     echo "</a>";
                 }
                 echo " <a class='news_date more' href='{$thisURL}' title='{$thistitle}'>" . __('Full story', 'govintranet') . " <span class='dashicons dashicons-arrow-right-alt2'></span></a></span></p>";
             } else {
                 if ($showexcerpt == 'on') {
                     echo "<p>";
                     echo '<span class="listglyph">' . get_the_date(get_option('date_format'));
                     echo '</span> ';
                     echo " <span class='badge'>" . __('Featured', 'govitranet') . "</span>";
                     if (get_comments_number()) {
                         echo "<a href='" . $thisURL . "#comments'>";
                         printf(_n('<span class="badge">1 comment</span>', '<span class="badge">%d comments</span>', get_comments_number(), 'govintranet'), get_comments_number());
                         echo "</a>";
                     }
                     echo "</p>";
                     echo $thisexcerpt;
                     echo "<p class='news_date'><a class='more' href='{$thisURL}' title='{$thistitle}'>" . __('Full story', 'govintranet') . " <span class='dashicons dashicons-arrow-right-alt2'></span></a></p>";
                 } else {
                     echo "<p>";
                     echo '<span class="listglyph">' . get_the_date(get_option('date_format'));
                     echo '</span> ';
                     echo " <span class='badge'>" . __('Featured', 'govitranet') . "</span>";
                     if (get_comments_number()) {
                         echo "<a href='" . $thisURL . "#comments'>";
                         printf(_n('<span class="badge">1 comment</span>', '<span class="badge">%d comments</span>', get_comments_number(), 'govintranet'), get_comments_number());
                         echo "</a>";
                     }
                     echo " <a class='news_date more' href='{$thisURL}' title='{$thistitle}'>" . __('Full story', 'govintranet') . " <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")));
     if ($newstypes) {
         $cquery['tax_query'] = array("relation" => "AND", array('taxonomy' => 'news-type', 'terms' => $newstypes, 'field' => 'id'), 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") {
             if ($video) {
                 echo $video;
             } elseif (has_post_thumbnail($post->ID)) {
                 $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');
                 echo "<a href='{$thisURL}'>" . get_the_post_thumbnail($post->ID, 'newshead', array('class' => 'img-responsive')) . "</a>";
                 echo wpautop("<p class='news_date'>" . get_post_thumbnail_caption() . "</p>");
             }
         }
         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(get_option('date_format'));
         $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(get_option('date_format'));
             echo '</span> ';
             if (get_comments_number()) {
                 echo "<a href='" . $thisURL . "#comments'>";
                 printf(_n('<span class="badge">1 comment</span>', '<span class="badge">%d comments</span>', get_comments_number(), 'govintranet'), get_comments_number());
                 echo "</a>";
             }
             echo "</p>";
         } else {
             if ($showexcerpt == 'on') {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date(get_option('date_format'));
                 echo '</span> ';
                 if (get_comments_number()) {
                     echo " <a href='" . $thisURL . "#comments'>";
                     printf(_n('<span class="badge">1 comment</span>', '<span class="badge">%d comments</span>', get_comments_number(), 'govintranet'), get_comments_number());
                     echo "</a>";
                 }
                 echo "</p>";
                 echo $thisexcerpt;
                 echo "<p class='news_date'><a class='more' href='{$thisURL}' title='{$thistitle}'>" . __('Full story', 'govintranet') . " <span class='dashicons dashicons-arrow-right-alt2'></span></a></p>";
             } else {
                 echo "<p>";
                 echo '<span class="listglyph">' . get_the_date(get_option('date_format'));
                 echo '</span> ';
                 if (get_comments_number()) {
                     echo " <a href='" . $thisURL . "#comments'>";
                     printf(_n('<span class="badge">1 comment</span>', '<span class="badge">%d comments</span>', get_comments_number(), 'govintranet'), get_comments_number());
                     echo "</a>";
                 }
                 echo " <a class='news_date more' href='{$thisURL}' title='{$thistitle}'>" . __('Full story', 'govintranet') . " <span class='dashicons dashicons-arrow-right-alt2'></span></a></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]);
     }
     if (!$moretitle) {
         $moretitle = $title;
     }
     if ($moretitle = "no_title_" . $id) {
         $moretitle = __("More", "govintranet");
     }
     if (is_array($newstypes) && count($newstypes) < 2) {
         $term = intval($newstypes[0]);
         $landingpage = get_term_link($term, 'news-type');
         echo '<p class="more-updates"><strong><a title="' . $landingpage_link_text . '" class="small" href="' . $landingpage . '">' . $moretitle . '</a></strong> <span class="dashicons dashicons-arrow-right-alt2"></span></p>';
     } else {
         $landingpage_link_text = $moretitle;
         echo '<p class="more-updates"><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;
 }
示例#5
0
<?php

global $post;
global $gallery;
global $title;
echo "<div class='widget-box'><div class='aggregator gallery'>";
if ($title) {
    echo "<h3>" . esc_attr($title) . "</h3>";
}
$gtemp = array();
foreach ($gallery as $g) {
    $html = '';
    $img = wp_get_attachment_image_src($g['ID'], 'full');
    $html .= "<dl class='gallery-item'>";
    $html .= "<dt class='gallery-icon'>";
    $html .= "<a rel='prettyPhoto[gallery-" . $g->ID . "]' href='" . $img[0] . "'>";
    $istyle = '';
    $img = wp_get_attachment_image_src($g['ID'], 'thumbnail');
    $html .= "<img src='" . $img[0] . "' class='gallery-item' width='" . $img[1] . "' height='" . $img[2] . "' alt='" . get_post_thumbnail_caption($g['ID']) . "' " . $istyle . "/>";
    $html .= "</a>";
    $html .= "</dt>";
    $html .= "</dl>";
    $grids[] = $html;
}
echo implode("", $grids);
echo "</div>";
echo "</div>";
echo "<div class='clearfix'></div>";
wp_reset_postdata();
?>