-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpage-news.php
More file actions
61 lines (52 loc) · 1.73 KB
/
Copy pathpage-news.php
File metadata and controls
61 lines (52 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Template Name: News Page
*
* @package WordPress
* @subpackage Twenty_Thirteen
* @since Twenty Thirteen 1.0
*/
get_header(); ?>
<div id="primary" class="content-area container">
<div id="content" class="site-content" role="main">
<div class="row padded-row">
<h1 class="col-md-12">News</h1>
</div>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$query = new WP_Query( 'cat=2,3,4,7,18,19&paged=' . $paged );
?>
<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="row row-padded">
<div class="date col-md-2">
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
<p><?php the_time( 'F jS, Y' ); ?></p>
</div>
<div class="post col-md-10">
<?php
$link = get_post_meta($post->ID, '_custom_news_source_url', true);
$external = true;
if(!$link) {
$external = false;
$link = get_the_permalink();
}
?>
<!-- Display the Title as a link to the Post's permalink. -->
<h1 class="news-title"><?php if($external) print '<span class="fa fa-external-link"></span>'; ?><a href="<?php echo $link; ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<div class="entry">
<?php the_excerpt(); ?>
</div>
</div> <!-- closes the first div box -->
</div>
<hr>
<?php endwhile; ?>
<?php next_posts_link('« Older Entries', $query->max_num_pages) ?>
<?php previous_posts_link('Newer Entries »') ?>
<?php wp_reset_postdata();
else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>