Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Modifications to page.php to support subpage sidebars
Browse files Browse the repository at this point in the history
  • Loading branch information
jmr06005 committed Jun 24, 2014
1 parent 23457e9 commit 113753e
Showing 1 changed file with 63 additions and 63 deletions.
126 changes: 63 additions & 63 deletions page.php
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package cornerstone
*/

get_header(); ?>
<h1>page.php</h1>
<?php
// sidebar custom field check.
$sidebar = get_post_meta( get_the_ID(), 'uc_sidebar', true );
if( !is_active_sidebar( $sidebar ) ){
foreach(get_post_ancestors(get_the_ID()) as $ancestor){
$parent_sidebar = get_post_meta( $ancestor, 'uc_sidebar', true );
$parent_sidebar_children = get_post_meta( $ancestor, 'uc_sidebar_children', true );
if( is_active_sidebar( $parent_sidebar ) && $parent_sidebar_children != '' && $parent_sidebar_children ){
$sidebar = $parent_sidebar;
break;
}
}
}
?>
<div class="row">
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<h1>Sidebar?</h1>
<?php
$side = dynamic_sidebar(apply_filters( 'ups_sidebar', 'default-sidebar-id' ) );
if ($side !=null)

echo '<h1>'.$side.' </h1>';
?>
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content', 'page' ); ?>

<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) :
comments_template();
endif;
?>

<?php endwhile; // end of the loop. ?>

</main><!-- #main -->
</div><!-- #primary -->
</div>
<?php
if ( is_active_sidebar( $sidebar ) ) {
echo '<div class="col-sm-3">';
dynamic_sidebar( $sidebar );
echo '</div>';
} ?>
</div>
<?php get_footer(); ?>
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package cornerstone
*/

get_header(); ?>
<h1>page.php</h1>
<?php
// sidebar custom field check.
$sidebar = get_post_meta( get_the_ID(), 'uc_sidebar', true );
if( !is_active_sidebar( $sidebar ) ){
foreach(get_post_ancestors(get_the_ID()) as $ancestor){
$parent_sidebar = get_post_meta( $ancestor, 'uc_sidebar', true );
$parent_sidebar_children = get_post_meta( $ancestor, 'uc_sidebar_children', true );
if( is_active_sidebar( $parent_sidebar ) && $parent_sidebar_children != '' && $parent_sidebar_children ){
$sidebar = $parent_sidebar;
break;
}
}
}
?>
<div class="row">
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<h1>Sidebar?</h1>
<?php
$side = dynamic_sidebar(apply_filters( 'ups_sidebar', 'default-sidebar-id' ) );
if ($side !=null)

echo '<h1>'.$side.' </h1>';
?>
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content', 'page' ); ?>

<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) :
comments_template();
endif;
?>

<?php endwhile; // end of the loop. ?>

</main><!-- #main -->
</div><!-- #primary -->
</div>
<?php
if ( is_active_sidebar( $sidebar ) ) {
echo '<div class="col-sm-3">';
dynamic_sidebar( $sidebar );
echo '</div>';
} ?>
</div>
<?php get_footer(); ?>

0 comments on commit 113753e

Please sign in to comment.