first commit
This commit is contained in:
68
template-parts/footer/block-section.php
Normal file
68
template-parts/footer/block-section.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying the footer block.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package PressBook
|
||||
*/
|
||||
|
||||
$pressbook_footer_block = PressBook\Options\FooterBlock::get_footer_block();
|
||||
|
||||
if ( empty( $pressbook_footer_block ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ( is_front_page() && ! $pressbook_footer_block['in_front'] ) ||
|
||||
( is_home() && ! $pressbook_footer_block['in_blog'] ) ||
|
||||
( is_archive() && ! $pressbook_footer_block['in_archive'] ) ||
|
||||
( is_404() ) ||
|
||||
( is_search() && ! $pressbook_footer_block['in_archive'] ) ||
|
||||
( is_single() && ! $pressbook_footer_block['in_post'] ) ||
|
||||
( ( ! is_front_page() && is_page() ) && ! $pressbook_footer_block['in_page'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pressbook_footer_block_query = new \WP_Query(
|
||||
array(
|
||||
'post_type' => 'wp_block',
|
||||
'no_found_rows' => true,
|
||||
'post__in' => ( empty( $pressbook_footer_block['id'] ) ? array( 0 ) : array( $pressbook_footer_block['id'] ) ),
|
||||
)
|
||||
);
|
||||
|
||||
if ( $pressbook_footer_block_query->have_posts() ) {
|
||||
if ( $pressbook_footer_block['b_margin'] ) {
|
||||
$pressbook_footer_block_class = 'block-section footer-block footer-block-1 b-margin';
|
||||
} else {
|
||||
$pressbook_footer_block_class = 'block-section footer-block footer-block-1';
|
||||
}
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $pressbook_footer_block_class ); ?>">
|
||||
<?php
|
||||
if ( ! $pressbook_footer_block['full_width'] ) {
|
||||
?>
|
||||
<div class="u-wrapper">
|
||||
<?php
|
||||
}
|
||||
|
||||
while ( $pressbook_footer_block_query->have_posts() ) {
|
||||
$pressbook_footer_block_query->the_post();
|
||||
?>
|
||||
<div class="entry-content">
|
||||
<?php the_content(); ?>
|
||||
</div><!-- .entry-content -->
|
||||
<?php
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
if ( ! $pressbook_footer_block['full_width'] ) {
|
||||
?>
|
||||
</div><!-- .u-wrapper -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div><!-- .footer-block-1 -->
|
||||
<?php
|
||||
}
|
||||
23
template-parts/footer/copyright-text.php
Normal file
23
template-parts/footer/copyright-text.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying the footer copyright text.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package PressBook
|
||||
*/
|
||||
|
||||
$pressbook_copyright_text = PressBook\Options\Footer::get_copyright_text();
|
||||
?>
|
||||
|
||||
<div class="copyright-text">
|
||||
<div class="u-wrapper copyright-text-wrap">
|
||||
<?php
|
||||
if ( '' !== $pressbook_copyright_text ) {
|
||||
?>
|
||||
<p><?php echo wp_kses( $pressbook_copyright_text, PressBook\Options\Footer::copyright_text_allowed_tags() ); ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div><!-- .copyright-text-wrap -->
|
||||
</div><!-- .copyright-text -->
|
||||
30
template-parts/footer/widgets.php
Normal file
30
template-parts/footer/widgets.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying the footer widgets section.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package PressBook
|
||||
*/
|
||||
|
||||
$pressbook_active_footer_widgets = PressBook\Widget::get_active_footer_widgets();
|
||||
|
||||
if ( $pressbook_active_footer_widgets > 0 ) {
|
||||
?>
|
||||
<div class="footer-widgets footer-widgets-<?php echo esc_attr( $pressbook_active_footer_widgets ); ?>">
|
||||
<div class="u-wrapper footer-widgets-wrap">
|
||||
<?php
|
||||
for ( $i = 1; $i <= PressBook\Widget::FOOTER_WIDGETS_COUNT; $i++ ) {
|
||||
if ( is_active_sidebar( 'footer-' . $i ) ) {
|
||||
?>
|
||||
<aside id="<?php echo esc_attr( 'sidebar-footer-' . $i ); ?>" class="widget-area c-sidebar-footer <?php echo esc_attr( 'c-sidebar-footer-' . $i ); ?>">
|
||||
<?php dynamic_sidebar( 'footer-' . $i ); ?>
|
||||
</aside><!-- .c-sidebar-footer -->
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div><!-- .footer-widgets-wrap -->
|
||||
</div><!-- .footer-widgets -->
|
||||
<?php
|
||||
}
|
||||
Reference in New Issue
Block a user