-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-news.php
129 lines (118 loc) · 3.44 KB
/
archive-news.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* The template for displaying Archive pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Primemovers
*/
get_header();
$category = get_categories('orderby=ID&order=desc&title_li=&taxonomy=month');
$latestCat = $category[0]->slug;
$args = array( 'post_type' => 'news', 'orderby' => 'date',
'tax_query' => array(
array(
'taxonomy' => 'month',
'field' => 'slug',
'terms' => $latestCat
)
));
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) :
?>
<div class="branded-title">
<h1>Newsletter</h1>
<p><?php echo $category[0]->name ?></p>
</div>
</div>
</header><!-- #masthead -->
<div id="content" class="site-content group">
<div class="full-section secure-page">
<?php if( rcp_user_has_access($user_ID, 1) ) : ?>
<div class="group">
<article class="entry-content group secure-content branded-content">
<?php /* Start the Loop */ $i = 1; $fullWidth = 0;?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="content-block full">
<?php if($fullWidth == 0) {$fullWidth ++;} ?>
<?php elseif (get_field('news_video')): ?>
<div class="content-block full">
<?php if($fullWidth == 0) {$fullWidth ++;} ?>
<?php elseif($fullWidth == 0) : ?>
<?php if ($i % 2 == 0): ?>
<div class="content-block odd">
<?php $fullWidth = 0; ?>
<?php else : ?>
<div class="content-block even">
<?php $fullWidth = 0; ?>
<?php endif;?>
<?php elseif($fullWidth == 1) : ?>
<?php if ($i % 2 == 0): ?>
<div class="content-block even">
<?php $fullWidth = 0; ?>
<?php else : ?>
<div class="content-block odd">
<?php $fullWidth = 0; ?>
<?php endif;?>
<?php endif; ?>
<div class="news-article group">
<header class="news-title">
<a href = "<?php the_permalink(); ?>" >
<h3><?php the_title(); ?></h3>
</a>
</header>
<?php
if ( has_post_thumbnail() ) {
echo '<div class="thumbnail">';
the_post_thumbnail();
echo '</div>';
} elseif (get_field('news_video')) {
echo '<div class="thumbnail video">';
echo get_field('news_video');
echo '</div>';
}
?>
<div class="entry-content group">
<?php
if ( has_excerpt() ):
the_excerpt();
?>
<a href = "<?php the_permalink(); ?>">Read »</a>
<?php
else :
$ex = get_the_content();
$count = str_word_count($ex, 0);
//echo $count;
if( $count > 75) :
echo '<p>';
echo excerpt(75) . '...';
echo '</p>';
?>
<a href = "<?php the_permalink(); ?>">Read »</a>
<?php
else :
the_content();
//echo excerpt(75);
endif;
endif;
?>
</div>
</div>
</div>
<?php $i++; ?>
<?php endwhile; ?>
<?php //primemovers_content_nav( 'nav-below' ); ?>
</article>
<?php get_sidebar('newsletter'); ?>
</div><!-- #group -->
<?php else : ?>
<div class="full-section login-problem">
<div class="login-needed">Please use the login form above to see this content.</div>
</div>
<?php endif; ?>
<?php else : ?>
<?php get_template_part( 'no-results', 'archive' ); ?>
<?php endif; ?>
</div><!-- #secure-page -->
<?php get_footer('secure'); ?>