forked from billerickson/EA-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
69 lines (59 loc) · 1.54 KB
/
single.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
<?php
/**
* Single Post
*
* @package EAStarter
* @author Bill Erickson
* @since 1.0.0
* @license GPL-2.0+
**/
// Entry category in header
add_action( 'tha_entry_top', 'ea_entry_category', 8 );
add_action( 'tha_entry_top', 'ea_entry_author', 12 );
add_action( 'tha_entry_top', 'ea_entry_header_share', 13 );
/**
* Entry header share
*
*/
function ea_entry_header_share() {
do_action( 'ea_entry_header_share' );
}
/**
* After Entry
*
*/
function ea_single_after_entry() {
echo '<div class="after-entry">';
// Breadcrumbs
ea_breadcrumbs();
// Publish date
echo '<p class="publish-date">Published on ' . get_the_date( 'F j, Y' ) . '</p>';
// Sharing
do_action( 'ea_entry_footer_share' );
// Author Box
ea_author_box();
// Newsletter signup
$form_id = get_option( 'options_ea_newsletter_form' );
if( $form_id && function_exists( 'wpforms_display' ) )
wpforms_display( $form_id, true, true );
// Related Posts
$loop = new WP_Query( [
'posts_per_page' => 3,
'post__not_in' => [ get_the_ID() ],
'category_name' => ea_first_term( 'category', 'slug' ),
] );
if( $loop->have_posts() ):
echo '<section class="post-listing-block layout3">';
echo '<header><h2>Other articles you may like</h2></header>';
while( $loop->have_posts() ):
$loop->the_post();
get_template_part( 'partials/archive' );
endwhile;
echo '</section>';
wp_reset_postdata();
endif;
echo '</div>';
}
add_action( 'tha_content_while_after', 'ea_single_after_entry', 8 );
// Build the page
require get_template_directory() . '/index.php';