-
Notifications
You must be signed in to change notification settings - Fork 0
/
front-page-back.php
113 lines (87 loc) · 2.85 KB
/
front-page-back.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
<?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package youhadmeat_theme
*/
get_header();
?>
<!--Background for Front Page only-->
<style>
body{
background-color: #ebebeb;
margin: 0;
}
</style>
<div class="post-grid">
<?php
$args = array(
'numberposts' => 10,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true
);
$recent_posts_all = wp_get_recent_posts( $args );
foreach($recent_posts_all as $post){
$curPostTitle = $post["post_title"];
$curExcerptStr = (strlen($post["post_excerpt"]) > 500) ? substr($post["post_excerpt"],0,500).'...' :$post["post_excerpt"];
$curPostUrl = get_permalink($post["ID"]);
$curCategory = get_the_category($post["ID"]);
$curParentCategory = "";
foreach($curCategory as $cat){
if($cat->parent == 0){
$curParentCategory = $cat;
}
}
$authorName = get_the_author_meta('user_nicename',$post["post_author"]);
$authorUrl = ''.get_site_url().'/'.get_the_author_meta('user_nicename',$post["post_author"]).'';
$date = date_create($post["post_date"]);
echo '
<div class="item" style="background-image:url('.get_the_post_thumbnail_url($post["ID"], 'large').');">
<div class="hero__content__information">
<div class="hero__content__information__items">
<div class="pre-head">
<div class="latest">LATEST</div>
</div>
<div class="title" >'.$curPostTitle.'</div>
<div class="excerpt">'.$curExcerptStr.'</div>
<div class="meta">
<div class="category">'.strtoupper($curParentCategory->name).'</div>
<div class="author"><i class="fa fa-user"></i>'.strtoupper($authorName).'</div>
<div class="date"><i class="fa fa-calendar"></i>'.date_format($date , 'd F Y').'</div>
</div>
<div class="read-more"> <a href="'.$curPostUrl.'"> View Post </a> </div>
</div>
</div>
</div>
';
}
?>
</div>
<div class="main">
</div>
<div>
</div>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Front Page -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-7101197309332352"
data-ad-slot="4859855228"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php
/*get_sidebar();*/
get_footer();