Browse Source

Refactor normal templates

tags/5.0.0^2
Chris Wiegman 4 years ago
parent
commit
9fc255fa07
17 changed files with 249 additions and 250 deletions
  1. +43
    -33
      404.php
  2. +54
    -47
      archive.php
  3. +0
    -0
      comments.php
  4. +10
    -6
      footer.php
  5. +1
    -1
      functions.php
  6. +13
    -6
      header.php
  7. +2
    -2
      home.php
  8. +11
    -9
      index.php
  9. +10
    -3
      page-archive.php
  10. +0
    -71
      page-journal.php
  11. +14
    -11
      page-projects.php
  12. +10
    -8
      page-speaking.php
  13. +14
    -12
      page.php
  14. +13
    -5
      search.php
  15. +7
    -1
      sidebar.php
  16. +13
    -9
      single-project.php
  17. +34
    -26
      single.php

+ 43
- 33
404.php View File

@@ -2,55 +2,65 @@
/**
* The template for displaying 404 pages (not found).
*
* @package ChrisWiegman
* @since 5.0.0
*
* @package CW\Theme\Templates\Four_Oh_Four
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Four_Oh_Four;

use CW\Theme\Functions\Template_Tags;

get_header(); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<section class="error-404 not-found">
<header class="page-header">
<h1 class="page-title"><?php _e( 'Oops! That page can&rsquo;t be found.', 'chriswiegman' ); ?></h1>
</header><!-- .page-header -->
<section class="error-404 not-found">
<header class="page-header">
<h1 class="page-title"><?php esc_html_e( 'Oops! That page can&rsquo;t be found.', 'chriswiegman' ); ?></h1>
</header><!-- .page-header -->

<div class="page-content">
<p><?php _e( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'chriswiegman' ); ?></p>
<div class="page-content">
<p><?php esc_html_e( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'chriswiegman' ); ?></p>

<?php get_search_form(); ?>
<?php get_search_form(); ?>

<?php the_widget( 'WP_Widget_Recent_Posts' ); ?>
<?php the_widget( 'WP_Widget_Recent_Posts' ); ?>

<?php if ( chriswiegman_categorized_blog() ) : // Only show the widget if site has multiple categories. ?>
<?php if ( Template_Tags\categorized_blog() ) : // Only show the widget if site has multiple categories. ?>
<div class="widget widget_categories">
<h2 class="widget-title"><?php _e( 'Most Used Categories', 'chriswiegman' ); ?></h2>
<h2 class="widget-title"><?php esc_html_e( 'Most Used Categories', 'chriswiegman' ); ?></h2>
<ul>
<?php
wp_list_categories( array(
'orderby' => 'count',
'order' => 'DESC',
'show_count' => 1,
'title_li' => '',
'number' => 10,
) );
?>
<?php
wp_list_categories(
array(
'orderby' => 'count',
'order' => 'DESC',
'show_count' => 1,
'title_li' => '',
'number' => 10,
)
);
?>
</ul>
</div><!-- .widget -->
<?php endif; ?>
<?php endif; ?>

<?php
/* translators: %1$s: smiley */
$archive_content = '<p>' . sprintf( __( 'Try looking in the monthly archives. %1$s', 'chriswiegman' ), convert_smilies( ':)' ) ) . '</p>';
the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=</h2>$archive_content" );
?>
<?php
/* translators: %1$s: smiley */
$archive_content = '<p>' . sprintf( __( 'Try looking in the monthly archives. %1$s', 'chriswiegman' ), convert_smilies( ':)' ) ) . '</p>';
the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=</h2>$archive_content" );
?>

<?php the_widget( 'WP_Widget_Tag_Cloud' ); ?>
<?php the_widget( 'WP_Widget_Tag_Cloud' ); ?>

</div><!-- .page-content -->
</section><!-- .error-404 -->
</div><!-- .page-content -->
</section><!-- .error-404 -->

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

<?php get_footer(); ?>

+ 54
- 47
archive.php View File

@@ -2,72 +2,78 @@
/**
* The template for displaying archive pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
* @since 5.0.0
*
* @package ChrisWiegman
* @package CW\Theme\Templates\Archive
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Archive;

use CW\Theme\Functions\Template_Tags;

get_header(); ?>

<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<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() ) :
if ( is_category() ) :

single_cat_title();
_e( ' Posts', 'chriswiegman' );
single_cat_title();
esc_html_e( ' Posts', 'chriswiegman' );

elseif ( is_tag() ) :
single_tag_title();
elseif ( is_tag() ) :
single_tag_title();

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

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

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

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

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

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

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

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

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

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

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

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

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

else :
_e( 'Archives', 'chriswiegman' );
else :
esc_html_e( 'Archives', 'chriswiegman' );

endif;
endif;
?>
</h1>
</header><!-- .page-header -->
@@ -76,25 +82,26 @@ get_header(); ?>
<?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() );
/**
* 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( 'template-parts/content', get_post_format() );
?>

<?php endwhile; ?>

<?php chriswiegman_paging_nav(); ?>
<?php Template_Tags\paging_nav(); ?>

<?php else : ?>

<?php get_template_part( 'content', 'none' ); ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>

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

<?php get_sidebar(); ?>
<?php get_footer(); ?>

template-parts/comments.php → comments.php View File


+ 10
- 6
footer.php View File

@@ -1,11 +1,15 @@
<?php
/**
* The template for displaying the footer.
* The template for displaying archive pages.
*
* Contains the closing of the #content div and all content after
* @since 5.0.0
*
* @package ChrisWiegman
* @package CW\Theme\Templates\Footer
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Footer;
?>

</div><!-- #content -->
@@ -17,9 +21,9 @@
</div>
<!-- .site-info -->
<div class="site-info">
<span class="copyright">&copy; <?php echo date( 'Y', time() ); ?> Chris Wiegman</span> -
<span class="license"><a href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">Creative Commons Licensed</a></span> -
<span class="poweredby">Powered by <a href="http://wordpress.org/" title="WordPress" target="_blank">WordPress</a></span>
<span class="copyright">&copy; <?php echo esc_html( date( 'Y', time() ) ); ?> Chris Wiegman</span> -
<span class="license"><a href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank"><?php esc_html_e( 'Creative Commons Licensed', 'chriswiegman' ); ?></a></span> -
<span class="poweredby"><?php esc_html_e( 'Powered by', 'chriswiegman' ); ?> <a href="http://wordpress.org/" title="WordPress" target="_blank">WordPress</a></span>
</div>
<!-- .site-info -->
</div>


+ 1
- 1
functions.php View File

@@ -4,7 +4,7 @@
*
* @since 5.0.0
*
* @package CW\Theme\Functions
* @package CW\Theme
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/


+ 13
- 6
header.php View File

@@ -4,9 +4,16 @@
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package ChrisWiegman
* @since 5.0.0
*
* @package CW\Theme\Templates\Header
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/
?><!DOCTYPE html>

namespace CW\Theme\Templates\Header;
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
@@ -25,8 +32,8 @@ if ( is_home() && is_active_sidebar( 'intro' ) ) {
$intro_class = '';
}
?>
<div id="page" class="hfeed site <?php echo $intro_class; ?>">
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'chriswiegman' ); ?></a>
<div id="page" class="hfeed site <?php echo esc_attr( $intro_class ); ?>">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'chriswiegman' ); ?></a>

<?php
if ( is_user_logged_in() ) {
@@ -35,7 +42,7 @@ if ( is_home() && is_active_sidebar( 'intro' ) ) {
$hclass = '';
}
?>
<header id="masthead" class="<?php echo $hclass; ?>site-header" role="banner">
<header id="masthead" class="<?php echo esc_attr( $hclass ); ?>site-header" role="banner">
<div class="progress-wrap">
<div class="progress-indicator"></div>
</div>
@@ -46,7 +53,7 @@ if ( is_home() && is_active_sidebar( 'intro' ) ) {
</div>
</div>

<div class="menu-toggle"><?php _e( 'Menu', 'chriswiegman' ); ?></div>
<div class="menu-toggle"><?php esc_html_e( 'Menu', 'chriswiegman' ); ?></div>
<nav id="site-navigation" class="main-navigation" role="navigation">

<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>


+ 2
- 2
home.php View File

@@ -4,12 +4,12 @@
*
* @since 5.0.0
*
* @package chriswiegman
* @package CW\Theme\Templates\Home
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates;
namespace CW\Theme\Templates\Home;

use CW\Theme\Functions\Template_Tags;



+ 11
- 9
index.php View File

@@ -2,15 +2,17 @@
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
* @since 5.0.0
*
* @package ChrisWiegman
* @package CW\Theme\Templates\Index
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Index;

use CW\Theme\Functions\Template_Tags;

get_header(); ?>

<div id="primary" class="content-area">
@@ -27,16 +29,16 @@ get_header(); ?>
* 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() );
get_template_part( 'template-parts/content', get_post_format() );
?>

<?php endwhile; ?>

<?php chriswiegman_paging_nav(); ?>
<?php Template_Tags\paging_nav(); ?>

<?php else : ?>

<?php get_template_part( 'content', 'none' ); ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>



+ 10
- 3
page-archive.php View File

@@ -2,9 +2,15 @@
/**
* The template for the archive page
*
* @package ChrisWiegman
* @since 5.0.0
*
* @package CW\Theme\Templates\Page\Archive
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Page\Archive;

get_header(); ?>

<div id="primary" class="content-area">
@@ -12,9 +18,10 @@ get_header(); ?>

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

<?php get_template_part( 'content', 'archive' ); ?>
<?php get_template_part( 'template-parts/content', 'archive' ); ?>

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

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


+ 0
- 71
page-journal.php View File

@@ -1,71 +0,0 @@
<?php
/**
* The template for displaying the speaking page.
*
* 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 ChrisWiegman
*/

add_filter( 'body_class', 'multisite_body_classes' );

function multisite_body_classes( $classes ) {

$page = array_search( 'page', $classes );
$page_template = array_search( 'page-template-default', $classes );

if ( false !== $page ) {
unset( $classes[ $page ] );
}

if ( false !== $page_template ) {
unset( $classes[ $page_template ] );
}

$classes[] = 'journal';

return $classes;

}

get_header(); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php

$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;

$args = array(
'post_type' => array( 'morning-journal', 'evening-journal' ),
'order' => 'DESC',
'orderby' => 'date',
'posts_per_page' => 6,
'paged' => $paged,
);

$loop = new WP_Query( $args );

while ( $loop->have_posts() ) {

$loop->the_post();

get_template_part( 'content', 'journal' );

} // end of the loop.

chriswiegman_paging_nav( $loop );

?>

</main>

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

<?php get_sidebar(); ?>
<?php get_footer(); ?>

+ 14
- 11
page-projects.php View File

@@ -1,15 +1,16 @@
<?php
/**
* The template for displaying the projects.
* The template for the projects page
*
* 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.
* @since 5.0.0
*
* @package ChrisWiegman
* @package CW\Theme\Templates\Page\Projects
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Page\Projects;

get_header(); ?>

<div id="primary" class="content-area">
@@ -18,8 +19,8 @@ get_header(); ?>
<?php
while ( have_posts() ) {

the_post();
?>
the_post();
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
@@ -29,13 +30,15 @@ get_header(); ?>

<div class="entry-content">
<?php the_content(); ?>
<?php get_template_part( 'content', 'projects' ); ?>
<p class="projects-note">Note that "archived" projects are projects I am no longer involved in for one reason or another.</p>
<?php get_template_part( 'template-parts/content', 'projects' ); ?>
<p class="projects-note"><?php esc_html_e( 'Note that "archived" projects are projects I am no longer involved in for
one reason or another.', 'chriswiegman' ); ?></p>
</div>
<!-- .entry-content -->
</article><!-- #post-## -->

<?php } // end of the loop. ?>
<?php } // End of the loop.
?>

</main>
<!-- #main -->


+ 10
- 8
page-speaking.php View File

@@ -1,15 +1,16 @@
<?php
/**
* The template for displaying the speaking page.
* The template for the speaking page
*
* 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.
* @since 5.0.0
*
* @package ChrisWiegman
* @package CW\Theme\Templates\Page\Speaking
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Page\Speaking;

get_header(); ?>

<div id="primary" class="content-area">
@@ -29,12 +30,13 @@ get_header(); ?>

<div class="entry-content">
<?php the_content(); ?>
<?php get_template_part( 'content', 'speaking' ); ?>
<?php get_template_part( 'template-parts/content', 'speaking' ); ?>
</div>
<!-- .entry-content -->
</article><!-- #post-## -->

<?php } // end of the loop. ?>
<?php } // End of the loop.
?>

</main>
<!-- #main -->


+ 14
- 12
page.php View File

@@ -2,27 +2,29 @@
/**
* 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.
* @since 5.0.0
*
* @package ChrisWiegman
* @package CW\Theme\Templates\Page
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Page;

get_header(); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

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

<?php get_template_part( 'content', 'page' ); ?>
<?php get_template_part( 'template-parts/content', 'page' ); ?>

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

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

<?php get_sidebar(); ?>
<?php get_footer(); ?>

+ 13
- 5
search.php View File

@@ -1,10 +1,18 @@
<?php
/**
* The template for displaying search results pages.
* The template for the search results page
*
* @package ChrisWiegman
* @since 5.0.0
*
* @package CW\Theme\Templates\Search
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Search;

use CW\Theme\Functions\Template_Tags;

get_header(); ?>

<section id="primary" class="content-area">
@@ -25,16 +33,16 @@ get_header(); ?>
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part( 'content' );
get_template_part( 'template-parts/content' );
?>

<?php endwhile; ?>

<?php chriswiegman_paging_nav(); ?>
<?php Template_Tags\paging_nav(); ?>

<?php else : ?>

<?php get_template_part( 'content', 'none' ); ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>



+ 7
- 1
sidebar.php View File

@@ -2,9 +2,15 @@
/**
* The sidebar containing the main widget area.
*
* @package ChrisWiegman
* @since 5.0.0
*
* @package CW\Theme\Templates\Siebar
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Sidebar;

if ( ! is_active_sidebar( 'sidebar' ) ) {
return;
}


+ 13
- 9
single-project.php View File

@@ -1,15 +1,18 @@
<?php
/**
* The template for displaying all projects.
* The template for all single projects
*
* 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.
* @since 5.0.0
*
* @package ChrisWiegman
* @package CW\Theme\Templates\Single\Project
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Single\Project;

use CW\Theme\Functions\Template_Tags;

get_header(); ?>

<div id="primary" class="content-area">
@@ -17,11 +20,12 @@ get_header(); ?>

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

<?php get_template_part( 'content', 'project' ); ?>
<?php get_template_part( 'template-parts/content', 'project' ); ?>

<?php chriswiegman_post_nav(); ?>
<?php Template_Tags\post_nav(); ?>

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

</main>
<!-- #main -->


+ 34
- 26
single.php View File

@@ -1,10 +1,18 @@
<?php
/**
* The template for displaying all single posts.
* The template for all single posts
*
* @package ChrisWiegman
* @since 5.0.0
*
* @package CW\Theme\Templates\Single
*
* @author Chris Wiegman <chris@chriswiegman.com>
*/

namespace CW\Theme\Templates\Single;

use CW\Theme\Functions\Template_Tags;

get_header(); ?>

<div id="primary" class="content-area">
@@ -12,18 +20,18 @@ get_header(); ?>

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

<?php get_template_part( 'content', 'single' ); ?>
<?php get_template_part( 'template-parts/content', 'single' ); ?>

<?php

do_action( 'cw_before_author' );

$links = array(
'facebook' => get_the_author_meta( 'facebook' ),
'github' => get_the_author_meta( 'github' ),
'facebook' => get_the_author_meta( 'facebook' ),
'github' => get_the_author_meta( 'github' ),
'wordpress' => get_the_author_meta( 'wordpress' ),
'twitter' => get_the_author_meta( 'twitter' ),
'google' => get_the_author_meta( 'googleplus' ),
'twitter' => get_the_author_meta( 'twitter' ),
'google' => get_the_author_meta( 'googleplus' ),
);

$profiles = array();
@@ -47,28 +55,28 @@ get_header(); ?>
echo get_avatar( get_the_author_meta( 'ID' ), 100 );

if ( strlen( get_the_author_meta( 'url' ) ) > 1 ) {
echo '<strong>About <a href="' . get_the_author_meta( 'url' ) . '" target="_blank" title="' . get_the_author_meta( 'website_title' ) . '">' . get_the_author_meta( 'display_name' ) . '</a></strong>' . PHP_EOL;
echo '<strong>About <a href="' . esc_url( get_the_author_meta( 'url' ) ) . '" target="_blank" title="' . esc_attr( get_the_author_meta( 'website_title' ) ) . '">' . esc_html( get_the_author_meta( 'display_name' ) ) . '</a></strong>' . PHP_EOL;
} else {
echo '<strong>About ' . get_the_author_meta( 'display_name' ) . '</strong>' . PHP_EOL;
echo '<strong>About ' . esc_html( get_the_author_meta( 'display_name' ) ) . '</strong>' . PHP_EOL;
}

echo '<p>' . get_the_author_meta( 'description' ) . '</p>' . PHP_EOL;
echo '<p>' . wp_kses_post( get_the_author_meta( 'description' ) ) . '</p>' . PHP_EOL;

if ( $profiles['facebook']['length'] > 1 || $profiles['linkedin']['length'] > 1 || $profiles['twitter']['length'] > 1 || $profiles['google']['length'] > 1 ) {
if ( 1 < $profiles['facebook']['length'] || 1 < $profiles['linkedin']['length'] || 1 < $profiles['twitter']['length'] || 1 < $profiles['google']['length'] ) {

if ( ( $profiles['facebook']['length'] <= 1 && $profiles['google']['length'] <= 1 && $profiles['linkedin']['length'] <= 1 ) && $profiles['twitter']['length'] > 1 ) {
echo '<p id="authcontact">Follow ' . get_the_author_meta( 'first_name' ) . ' on <a href="http://twitter.com/' . $profiles['twitter']['url'] . '" target="_blank" title="' . get_the_author_meta( 'display_name' ) . ' on Twitter">Twitter</a></p>' . PHP_EOL;
if ( ( 1 >= $profiles['facebook']['length'] && 1 >= $profiles['google']['length'] && 1 >= $profiles['linkedin']['length'] ) && 1 < $profiles['twitter']['length'] ) {
echo '<p id="authcontact">Follow ' . esc_attr( get_the_author_meta( 'first_name' ) ) . ' on <a href="http://twitter.com/' . $profiles['twitter']['url'] . '" target="_blank" title="' . esc_attr( get_the_author_meta( 'display_name' ) ) . ' on Twitter">Twitter</a></p>' . PHP_EOL;
} else {

echo '<p id="authcontact">Find ' . get_the_author_meta( 'first_name' ) . ' on ';
echo '<p id="authcontact">Find ' . esc_html( get_the_author_meta( 'first_name' ) ) . ' on ';

if ( $profiles['facebook']['length'] > 1 ) {
if ( 1 < $profiles['facebook']['length'] ) {

echo ' <a href="https://facebook.com/' . $profiles['facebook']['url'] . '" target="_blank" title="' . get_the_author_meta( 'display_name' ) . ' on Facebook">Facebook</a>';
echo ' <a href="https://facebook.com/' . $profiles['facebook']['url'] . '" target="_blank" title="' . esc_attr( get_the_author_meta( 'display_name' ) ) . ' on Facebook">Facebook</a>';

}

if ( $profiles['google']['length'] > 1 ) {
if ( 1 < $profiles['google']['length'] ) {

$comma = $profiles['facebook']['length'] > 1 ? ',' : '';
$and = $profiles['facebook']['length'] > 1 && ( $profiles['github']['length'] <= 1 || $profiles['twitter']['length'] <= 1 ) ? ' and' : '';
@@ -76,7 +84,7 @@ get_header(); ?>

}

if ( $profiles['github']['length'] > 1 ) {
if ( 1 < $profiles['github']['length'] ) {

$comma = $profiles['facebook']['length'] > 1 || $profiles['google']['length'] > 1 ? ',' : '';
$and = ( $profiles['facebook']['length'] > 1 || $profiles['google']['length'] > 1 ) && $profiles['twitter']['length'] <= 1 ? ' and' : '';
@@ -84,22 +92,21 @@ get_header(); ?>

}

if ( $profiles['wordpress']['length'] > 1 ) {
if ( 1 < $profiles['wordpress']['length'] ) {

$comma = $profiles['facebook']['length'] > 1 || $profiles['google']['length'] > 1 || $profiles['github']['length'] > 1 ? ',' : '';
$comma = $profiles['facebook']['length'] > 1 || $profiles['google']['length'] > 1 || $profiles['github']['length'] > 1 ? ',' : '';
$and = ( $profiles['facebook']['length'] > 1 || $profiles['google']['length'] > 1 || $profiles['github']['length'] > 1 ) && $profiles['twitter']['length'] <= 1 ? ' and' : '';
echo $comma . $and . ' <a href="https://profiles.wordpress.org/' . $profiles['wordpress']['url'] . '" target="_blank" title="' . get_the_author_meta( 'display_name' ) . ' on WordPress.org">WordPress.org</a>';

}

if ( $profiles['twitter']['length'] > 1 ) {
if ( 1 < $profiles['twitter']['length'] ) {
echo ', and <a href="https://twitter.com/' . $profiles['twitter']['url'] . '" target="_blank" title="' . get_the_author_meta( 'display_name' ) . ' on Twitter">Twitter</a>';
}

echo '.</p>' . PHP_EOL;

}

}

echo '</div>' . PHP_EOL;
@@ -107,15 +114,16 @@ get_header(); ?>
?>

<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) :
// 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 chriswiegman_post_nav(); ?>
<?php Template_Tags\post_nav(); ?>

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

</main>
<!-- #main -->