-
Notifications
You must be signed in to change notification settings - Fork 0
/
latest-news.php
98 lines (73 loc) · 2.98 KB
/
latest-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
<?php
/**
* Template Name: Latest News
*
* @package semantify
* @subpackage semantify-theme
* @since 1.0
* @version 1.0
*/
if (!is_front_page()) {
get_header();
the_post();
}
?>
<article id="<?php global $post;
echo $post->post_name; ?>">
<div class="container" id="latest-news">
<div class="section">
<!-- Icon Section -->
<div class="row">
<div class="col s12">
<div class="nadpis center">
<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
</div>
<div class="claim-box center-align">
<div class="claim-text ">
<p>
<?php
/* translators: %s: Name of current post */
the_content();
?>
</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<div class="claim-box center-align">
<?php
// the query
$the_query = new WP_Query(array(
'category_name' => get_post_meta($post->ID,
'latest-news-category', 1),
'posts_per_page' => get_post_meta($post->ID,
'latest-news-posts', 1),
));
?>
<?php if ($the_query->have_posts()) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post();
$link = get_permalink($post);
?>
<a href="<?php echo $link; ?>"><h2
style="text-align:left;"><?php the_title(); ?></h2></a>
<div class="claim-text ">
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php __('No News'); ?></p>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</article>
<?php
if (!is_front_page()) {
get_footer();
}
?>