-
Notifications
You must be signed in to change notification settings - Fork 1
/
news-page.php
89 lines (78 loc) · 2.98 KB
/
news-page.php
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/*
Template name: News overview
*/
?>
<?php
/**
* The template for displaying the news overview page
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages and that other
* 'pages' on your WordPress site will use a different template.
*
* @package WordPress
* @subpackage Twenty_Thirteen
* @since Twenty Thirteen 1.0
*/
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<header class="entry-header">
<div class="subpage-entry-title">
<div class="subpage-entry-title-header">
<h2 class="single_post_subheader"><?php the_field('page_subheader'); ?></h2>
<h1><?php the_title(); ?></h1>
</div>
</div>
</header><!-- .entry-header -->
<?php endwhile; ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div id="subpage_content_container">
<div id="subpage_content" class="news_layout">
<h2 class="underline"><?php the_field('content_subheader'); ?></h2>
<div class="overview_news_content">
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'order' => 'DESC',
'post_status' => 'publish',
'paged' => $paged
);
query_posts($args); ?>
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
<div class="news_post">
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<a href="<?php echo the_permalink(); ?>"><div class="custom-bg" style="background-image: url('<?php echo $image[0]; ?>');"></div></a>
<?php endif; ?>
<div class="news_info">
<p class="news_date_overview"><strong><?php echo get_the_date('j F'); ?></strong></p>
<h5><a href="<?php echo the_permalink(); ?>" style="color:#574759;"><?php echo get_the_title(); ?></a></h5>
<p><?php
$content = get_the_content();
$trimmed_content = wp_trim_words( $content, 27, '<a href="'. get_permalink() .'"> <br>Read more ></a>' );
echo $trimmed_content;
?></p>
</div>
</div>
<?php endwhile; ?>
<?php numeric_posts_nav(); ?>
<?php else : ?>
<!-- No posts found -->
<?php endif; wp_reset_query(); ?>
</div>
</div>
<div id="subpage_sidebar">
<h2 class="underline">Twitter</h2>
<div class="twitter_widget">
<?php echo do_shortcode( '[twitter-widget username="onecaretweets" items=2 dateFormat="d F Y"]' ); ?>
</div>
</div>
</div>
</article><!-- #post -->
</div><!-- #content -->
</div><!-- #primary -->
<?php // get_sidebar(); ?>
<?php get_footer(); ?>