Skip to content

Commit

Permalink
Cleaning Up for Development
Browse files Browse the repository at this point in the history
Removed on screen comments
Enabled sidebars
Enabled page specific sidebars
Added div for widget content vs widget header.
Adjusted blog nav
  • Loading branch information
andrewmbacon committed Jun 26, 2014
1 parent 525138c commit 3f0ec3e
Show file tree
Hide file tree
Showing 12 changed files with 241 additions and 218 deletions.
189 changes: 96 additions & 93 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,98 +8,101 @@
*/

get_header(); ?>
<h1>archive.php</h1>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div class="row">
<div class="col-sm-9">
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php if ( have_posts() ) : ?>

<header class="page-header">
<h1 class="page-title">
<?php
if ( is_category() ) :
single_cat_title();

elseif ( is_tag() ) :
single_tag_title();

elseif ( is_author() ) :
printf( __( 'Author: %s', 'cs' ), '<span class="vcard">' . get_the_author() . '</span>' );

elseif ( is_day() ) :
printf( __( 'Day: %s', 'cs' ), '<span>' . get_the_date() . '</span>' );

elseif ( is_month() ) :
printf( __( 'Month: %s', 'cs' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'cs' ) ) . '</span>' );

elseif ( is_year() ) :
printf( __( 'Year: %s', 'cs' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'cs' ) ) . '</span>' );

elseif ( is_tax( 'post_format', 'post-format-aside' ) ) :
_e( 'Asides', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) :
_e( 'Galleries', 'cs');

elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
_e( 'Images', 'cs');

elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
_e( 'Videos', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
_e( 'Quotes', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
_e( 'Links', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-status' ) ) :
_e( 'Statuses', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-audio' ) ) :
_e( 'Audios', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-chat' ) ) :
_e( 'Chats', 'cs' );

else :
_e( 'Archives', 'cs' );

endif;
?>
</h1>
<?php
// Show an optional term description.
$term_description = term_description();
if ( ! empty( $term_description ) ) :
printf( '<div class="taxonomy-description">%s</div>', $term_description );
endif;
?>
</header><!-- .page-header -->

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>

<?php endwhile; ?>

<?php cs_paging_nav(); ?>

<?php else : ?>

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

<?php endif; ?>

</main><!-- #main -->
</section><!-- #primary -->
</div>
<?php get_sidebar(); ?>
</div>

<?php if ( have_posts() ) : ?>

<header class="page-header">
<h1 class="page-title">
<?php
if ( is_category() ) :
single_cat_title();

elseif ( is_tag() ) :
single_tag_title();

elseif ( is_author() ) :
printf( __( 'Author: %s', 'cs' ), '<span class="vcard">' . get_the_author() . '</span>' );

elseif ( is_day() ) :
printf( __( 'Day: %s', 'cs' ), '<span>' . get_the_date() . '</span>' );

elseif ( is_month() ) :
printf( __( 'Month: %s', 'cs' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'cs' ) ) . '</span>' );

elseif ( is_year() ) :
printf( __( 'Year: %s', 'cs' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'cs' ) ) . '</span>' );

elseif ( is_tax( 'post_format', 'post-format-aside' ) ) :
_e( 'Asides', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) :
_e( 'Galleries', 'cs');

elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
_e( 'Images', 'cs');

elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
_e( 'Videos', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
_e( 'Quotes', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
_e( 'Links', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-status' ) ) :
_e( 'Statuses', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-audio' ) ) :
_e( 'Audios', 'cs' );

elseif ( is_tax( 'post_format', 'post-format-chat' ) ) :
_e( 'Chats', 'cs' );

else :
_e( 'Archives', 'cs' );

endif;
?>
</h1>
<?php
// Show an optional term description.
$term_description = term_description();
if ( ! empty( $term_description ) ) :
printf( '<div class="taxonomy-description">%s</div>', $term_description );
endif;
?>
</header><!-- .page-header -->

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>

<?php endwhile; ?>

<?php cs_paging_nav(); ?>

<?php else : ?>

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

<?php endif; ?>

</main><!-- #main -->
</section><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
1 change: 0 additions & 1 deletion content.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
?>
<h1>Content.php</h1>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
Expand Down
2 changes: 1 addition & 1 deletion inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ function cs_setup_author() {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
}
}
add_action( 'wp', 'cs_setup_author' );
add_action( 'wp', 'cs_setup_author' );
35 changes: 31 additions & 4 deletions inc/reg-sidebars.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Sidebar',
'id' => 'sidebar',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
'name' => __( 'Sidebar', 'theme_text_domain' ),
'id' => 'sidebar',
'description' => 'Appears with Archives, Search Results, the Blog page template, and when viewing single posts.',
'class' => 'sidebar',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</div></aside>',
'before_title' => '<div class="widget-head"><h2 class="widget-title">',
'after_title' => '</h2></div><div class="widget-content">'
));
register_sidebar(array(
'name' => 'Home1',
Expand Down Expand Up @@ -69,6 +73,29 @@
));

}
register_sidebar( array(
'name' => __( 'Header Widget Area', 'theme' ),
'id' => 'header-widget-area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );

// if no title then add widget content wrapper to before widget
add_filter( 'dynamic_sidebar_params', 'check_sidebar_params' );
function check_sidebar_params( $params ) {
global $wp_registered_widgets;

$settings_getter = $wp_registered_widgets[ $params[0]['widget_id'] ]['callback'][0];
$settings = $settings_getter->get_settings();
$settings = $settings[ $params[1]['number'] ];

if ( $params[0][ 'after_widget' ] == '</div></aside>' && isset( $settings[ 'title' ] ) && empty( $settings[ 'title' ] ) )
$params[0][ 'before_widget' ] .= '<div class="widget-content">';

return $params;
}


?>
8 changes: 3 additions & 5 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function cs_paging_nav() {
}
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'cs' ); ?></h1>
<div class="nav-links">

<?php if ( get_next_posts_link() ) : ?>
Expand Down Expand Up @@ -49,11 +48,10 @@ function cs_post_nav() {
}
?>
<nav class="navigation post-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'cs' ); ?></h1>
<div class="nav-links">
<div class="nav-links row">
<?php
previous_post_link( '<div class="nav-previous">%link</div>', _x( '<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'cs' ) );
next_post_link( '<div class="nav-next">%link</div>', _x( '%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'cs' ) );
previous_post_link( '<div class="col-sm-6 nav-previous">%link</div>', _x( '<span class="meta-nav">&larr;</span> Previous', 'Previous post link', 'cs' ) );
next_post_link( '<div class="col-sm-6 nav-next">%link</div>', _x( 'Next <span class="meta-nav">&rarr;</span>', 'Next post link', 'cs' ) );
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
Expand Down
32 changes: 2 additions & 30 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,8 @@
*/

get_header(); ?>

<div class="row">
<!--

#phpneeded

If dynamic_sidebar() =! false/null...

<div class="col-sm-9">

else

<div class="col-sm-12">

-->
<div class="col-sm-9">
<div id="primary" class="content-area">

Expand Down Expand Up @@ -58,22 +46,6 @@

</div><!-- #primary -->
</div>
<!--

#phpneeded

If dynamic_sidebar() =! false/null...

<div class="col-sm-3">
<?php //dynamic_sidebar( apply_filters( 'ups_sidebar', 'default-sidebar-id' ) ); ?>
<?php //get_sidebar(); ?>
</div>


-->

<div class="col-sm-3">
<?php dynamic_sidebar( apply_filters( 'ups_sidebar', 'default-sidebar-id' ) ); ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
11 changes: 6 additions & 5 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@
</div><!-- #primary -->
</div>
<?php
if ( is_active_sidebar( $sidebar ) ) {
echo '<div class="col-sm-3">';
dynamic_sidebar( $sidebar );
echo '</div>';
} ?>
if ( is_active_sidebar( $sidebar ) ) {
echo '<div class="col-sm-3">';
dynamic_sidebar( $sidebar );
echo '</div>';
}
?>
</div><!-- /row -->
<?php get_footer(); ?>
Loading

0 comments on commit 3f0ec3e

Please sign in to comment.