Skip to content

Commit

Permalink
Make the article-bottom widget area into an action
Browse files Browse the repository at this point in the history
  • Loading branch information
benlk committed Feb 10, 2016
1 parent c044af0 commit 17b27be
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
21 changes: 21 additions & 0 deletions inc/sidebars.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,30 @@ function largo_sidebar_span_class() {
return 'span4';
}

/**
* Output the "Header Widget" sidebar
*
* @action largo_header_after_largo_header
* @since 0.5.5
*/
function largo_header_widget_sidebar() {
if ( of_get_option('header_widget_enabled') ) {
dynamic_sidebar('header-widget');
}
}
add_action('largo_header_after_largo_header', 'largo_header_widget_sidebar');

/**
* Output the "Article Bottom" sidebar
*
* @action largo_header_after_largo_header
* @since 0.5.5
*/
function largo_post_bottom_widget_area() {
if ( is_active_sidebar( 'article-bottom' ) ) {
echo '<div class="article-bottom nocontent">';
dynamic_sidebar( 'article-bottom' );
echo '</div>';
}
}
add_action('largo_post_bottom_widget_area', 'largo_post_bottom_widget_area');
11 changes: 3 additions & 8 deletions single-one-column.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,12 @@
get_template_part( 'partials/content', $partial );

if ( $partial === 'single' ) {
if ( is_active_sidebar( 'article-bottom' ) ) {

do_action( 'largo_before_post_bottom_widget_area' );
do_action( 'largo_before_post_bottom_widget_area' );

echo '<div class="article-bottom nocontent">';
dynamic_sidebar( 'article-bottom' );
echo '</div>';
do_action( 'largo_post_bottom_widget_area' );

do_action( 'largo_after_post_bottom_widget_area' );

}
do_action( 'largo_after_post_bottom_widget_area' );

do_action( 'largo_before_comments' );

Expand Down
18 changes: 6 additions & 12 deletions single-two-column.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,28 @@
?>

<div id="content" class="span8" role="main">

<?php
while ( have_posts() ) : the_post();

$shown_ids[] = get_the_ID();

$partial = ( is_page() ) ? 'page' : 'single-classic';

get_template_part( 'partials/content', $partial );

if ( $partial == 'single-classic' ) {
if ( is_active_sidebar( 'article-bottom' ) ) {

do_action( 'largo_before_post_bottom_widget_area' );

echo '<div class="article-bottom nocontent">';
dynamic_sidebar( 'article-bottom' );
echo '</div>';
do_action( 'largo_before_post_bottom_widget_area' );

do_action( 'largo_after_post_bottom_widget_area' );
do_action( 'largo_post_bottom_widget_area' );

}
do_action( 'largo_after_post_bottom_widget_area' );

do_action('largo_before_comments');
do_action( 'largo_before_comments' );

comments_template( '', true );

do_action('largo_after_comments');
do_action( 'largo_after_comments' );
}

endwhile;
Expand Down

0 comments on commit 17b27be

Please sign in to comment.