-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
84 lines (67 loc) · 2.25 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package buddyx
*/
namespace BuddyX\Buddyx;
get_header();
buddyx()->print_styles( 'buddyx-content' );
buddyx()->print_styles( 'buddyx-sidebar', 'buddyx-widgets' );
if ( get_post_type() == 'post' ) {
$default_sidebar = get_theme_mod( 'single_post_sidebar_option', buddyx_defaults( 'single-post-sidebar-option' ) );
} else {
$default_sidebar = get_theme_mod( 'sidebar_option', buddyx_defaults( 'sidebar-option' ) );
}
$single_post_content_width = '';
$classes = '';
if ( get_post_type() == 'post' ) {
$single_post_content_width = get_theme_mod( 'single_post_content_width', buddyx_defaults( 'single-post-content-width' ) );
// Sidebar Classes
if ( $default_sidebar == 'left' ) {
$classes = 'has-single-post-left-sidebar';
} elseif ( $default_sidebar == 'right' ) {
$classes = 'has-single-post-right-sidebar';
} elseif ( $default_sidebar == 'both' ) {
$classes = 'has-single-post-both-sidebar';
} else {
$classes = 'has-single-post-no-sidebar';
}
}
?>
<div class="single-post-main-wrapper buddyx-content--<?php echo esc_attr( $single_post_content_width ); ?> <?php echo esc_attr( $classes ); ?>">
<?php do_action( 'buddyx_sub_header' ); ?>
<?php
if ( get_post_type() == 'post' ) {
get_template_part( 'template-parts/content/entry-header', get_post_type() );
}
?>
<?php do_action( 'buddyx_before_content' ); ?>
<?php if ( $default_sidebar == 'left' || $default_sidebar == 'both' ) : ?>
<aside id="secondary" class="left-sidebar widget-area">
<div class="sticky-sidebar">
<?php buddyx()->display_left_sidebar(); ?>
</div>
</aside>
<?php endif; ?>
<main id="primary" class="site-main">
<?php
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content/entry', get_post_type() );
}
?>
</main><!-- #primary -->
<?php if ( $default_sidebar == 'right' || $default_sidebar == 'both' ) : ?>
<aside id="secondary" class="primary-sidebar widget-area">
<div class="sticky-sidebar">
<?php buddyx()->display_right_sidebar(); ?>
</div>
</aside>
<?php endif; ?>
<?php do_action( 'buddyx_after_content' ); ?>
</div>
<?php
get_footer();