-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfront-page.php
More file actions
117 lines (101 loc) · 4.86 KB
/
Copy pathfront-page.php
File metadata and controls
117 lines (101 loc) · 4.86 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
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
<?php get_header('main'); ?>
<section class="content">
<main class="home no-padding" role="main">
<!-- Hero -->
<?php if(get_theme_mod('hero-display', 'static') != 'hide') {
if (get_theme_mod('hero-display', 'static') == 'static') {
$hero_heading = get_theme_mod('hero_heading', 'Welcome to <br>' . get_bloginfo('title'));
$hero_subheading1 = get_theme_mod('hero_subheading1', 'From your_name_here');
$hero_subheading2 = get_theme_mod('hero_subheading2', get_bloginfo('description'));
$hero_bgimage = wp_get_attachment_image_url(get_theme_mod('hero_bgimage'));
$hero_button_link = '';
} else {
$recent_posts = get_posts(array(
'numberposts' => 1, // Number of recent posts thumbnails to display
'post_status' => 'publish' // Show only the published posts
));
$recent_post = $recent_posts[0];
$hero_heading =$recent_post->post_title;
$hero_subheading1 = $recent_post->post_date_gmt;
$hero_subheading2 = $recent_post->post_excerpt;
$hero_bgimage = get_the_post_thumbnail_url($recent_post->ID, 'hero-thumb');
$hero_button_link = get_permalink( $recent_post->ID );
}
?>
<section class="hero" style="background-image: url('<?php echo $hero_bgimage ?>')">
<div class="pixels" style="background-image:url(<?php echo get_template_directory_uri() . '/assets/img/pixels.png' ?>)"></div>
<div class="gradient"></div>
<div class="content">
<time datetime="2008-02-14 20:00" class="date">
<?php echo $hero_subheading1 ?>
</time>
<h1 class="title"><?php echo $hero_heading ?></h1>
<p class="description"><?php echo $hero_subheading2 ?></p>
<?php if($hero_button_link) { ?>
<div class="buttons">
<a href="<?php echo $hero_button_link ?>" role="button" class="button">
<svg><use xlink:href="#icon-read"></use></svg>
<span>Read Now</span>
</a>
</div>
<?php } ?>
</div>
</section>
<?php } ?>
<!-- Posts -->
<section id="grid" class="row flex-grid">
<?php
$homepagePosts = new WP_Query(array(
'posts_per_page' => 4
));
while ($homepagePosts->have_posts()) {
$homepagePosts->the_post();
get_template_part('template-parts/content', 'archive');
}
wp_reset_postdata();
?>
<div class="pagination pagination-home">
<div class="buttons">
<a href="<?php echo get_post_type_archive_link('post') ?>" role="button" class="button">
<svg><use xlink:href="#icon-read"></use></svg>
<span>View All Blog Posts</span>
</a>
</div>
</div>
</section>
<!-- Code Snippets -->
<sction>
<div class="code-snippet-cards">
<?php
$homepageCodeSnippets = new WP_Query(array(
'post_type' => 'code_snippets',
'posts_per_page' => 8
));
while ($homepageCodeSnippets->have_posts()) {
$homepageCodeSnippets->the_post();
get_template_part('template-parts/content', 'archive_code_snippets');
}
wp_reset_postdata();
?>
</div>
<div class="pagination pagination-home">
<div class="buttons">
<a href="<?php echo get_post_type_archive_link('code_snippets') ?>" role="button" class="button">
<svg><use xlink:href="#icon-code"></use></svg>
<span>View All Code Snippets</span>
</a>
</div>
</div>
</sction>
<!-- Front Page Content -->
<section class="content">
<div class="post">
<article class="home-content fullwidth">
<?php the_content();
// echo base64_encode(openssl_random_pseudo_bytes(64)); ?>
</article>
</div>
</section>
</main>
</section>
<?php get_footer(); ?>