Skip to content

Commit

Permalink
Coding Standards
Browse files Browse the repository at this point in the history
  • Loading branch information
giucu91 committed Dec 21, 2017
1 parent d0c946a commit 286ecde
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 91 deletions.
63 changes: 30 additions & 33 deletions archive-jetpack-portfolio.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?php
get_header();

$layout = get_theme_mod( 'projects_layout_view', 'mansonry' );
$layout = get_theme_mod( 'projects_layout_view', 'mansonry' );
$layout_class = shapely_get_layout_class();

$item_classes = 'post-snippet col-md-3 col-sm-6 project';
if ( 'mansonry' == $layout ) {
$item_classes .= ' masonry-item';
}

if ( 'sidebar-left' == $layout_class ) :
get_sidebar();
endif;
?>
<?php
if ( 'sidebar-left' == $layout_class ) :
get_sidebar();
endif;
?>
<div id="primary" class="content-area col-md-8 mb-xs-24 <?php echo esc_attr( $layout_class ); ?>">
<main id="main" class="site-main" role="main">

Expand All @@ -29,7 +27,7 @@
</div>
</div>
<?php endif ?>

<div class="<?php echo 'mansonry' == $layout ? 'masonry masonryFlyIn' : ''; ?>">
<?php
/* Start the Loop */
Expand All @@ -41,35 +39,35 @@
$project_types = wp_get_post_terms( $post->ID, 'jetpack-portfolio-type', $projects_args );

$thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), 'full' );
$item_style = '';
$item_style = '';
if ( 'mansonry' != $layout ) {
$item_style = 'background-image: url(' . $thumbnail_url . ')';
}
?>
?>

<article id="post-<?php the_ID(); ?>" <?php post_class( $item_classes ); ?>>
<div class="image-tile inner-title hover-reveal text-center" style="<?php echo $item_style; ?>">
<?php
if ( has_post_thumbnail() ) {
?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
if ( 'mansonry' == $layout ) {
the_post_thumbnail( 'medium' );
}
<div class="image-tile inner-title hover-reveal text-center" style="<?php echo $item_style; ?>">
<?php
if ( has_post_thumbnail() ) {
?>
<div class="title">
<?php
the_title( '<h5 class="mb0">', '</h5>' );
if ( ! empty( $project_types ) ) {
echo '<span>' . implode( ' / ', $project_types ) . '</span>';
}
?>
</div>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
if ( 'mansonry' == $layout ) {
the_post_thumbnail( 'medium' );
}
?>
<div class="title">
<?php
the_title( '<h5 class="mb0">', '</h5>' );
if ( ! empty( $project_types ) ) {
echo '<span>' . implode( ' / ', $project_types ) . '</span>';
}
?>
</div>
</a>
<?php
}
?>
}
?>
</div>
</article><!-- #post-## -->
<?php
Expand All @@ -87,10 +85,9 @@

</main><!-- #main -->
</div><!-- #primary -->
<?php
if ( 'sidebar-right' == $layout_class ) :
get_sidebar();
endif;
?>
<?php
if ( 'sidebar-right' == $layout_class ) :
get_sidebar();
endif;

get_footer();
21 changes: 8 additions & 13 deletions inc/admin/welcome-screen/class-shapely-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct() {
)
);

$theme = wp_get_theme();
$theme = wp_get_theme();
$this->theme_name = $theme->get( 'Name' );
$this->theme_slug = $theme->get( 'TextDomain' );

Expand Down Expand Up @@ -109,8 +109,7 @@ public function shapely_welcome_admin_notice() {
?>
<div class="updated notice is-dismissible">
<p><?php echo sprintf( esc_html__( 'Welcome! Thank you for choosing Shapely! To fully take advantage of the best our theme can offer please make sure you visit our %1$swelcome page%2$s.', 'shapely' ), '<a href="' . esc_url( admin_url( 'themes.php?page=shapely-welcome' ) ) . '">', '</a>' ); ?></p>
<p><a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome' ) ); ?>" class="button"
style="text-decoration: none;"><?php echo esc_html__( 'Get started with Shapely', 'shapely' ); ?></a>
<p><a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome' ) ); ?>" class="button" style="text-decoration: none;"><?php echo esc_html__( 'Get started with Shapely', 'shapely' ); ?></a>
</p>
</div>
<?php
Expand Down Expand Up @@ -289,13 +288,13 @@ public function check_active( $slug ) {

return array(
'status' => is_plugin_active( $slug2 ),
'needs' => $needs,
'needs' => $needs,
);
}

return array(
'status' => false,
'needs' => 'install',
'needs' => 'install',
);
}

Expand Down Expand Up @@ -381,15 +380,11 @@ class="about-text"><?php echo esc_html__( 'Shapely is now installed and ready to


<h2 class="nav-tab-wrapper wp-clearfix">
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=getting_started' ) ); ?>"
class="nav-tab <?php echo 'getting_started' == $active_tab ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__( 'Getting Started', 'shapely' ); ?></a>
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ) ); ?>"
class="nav-tab <?php echo 'recommended_actions' == $active_tab ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Recommended Actions', 'shapely' ); ?>
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=getting_started' ) ); ?>" class="nav-tab <?php echo 'getting_started' == $active_tab ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__( 'Getting Started', 'shapely' ); ?></a>
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ) ); ?>" class="nav-tab <?php echo 'recommended_actions' == $active_tab ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Recommended Actions', 'shapely' ); ?>
<?php echo $action_count > 0 ? '<span class="badge-action-count">' . esc_html( $action_count ) . '</span>' : ''; ?></a>
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_plugins' ) ); ?>"
class="nav-tab <?php echo 'recommended_plugins' == $active_tab ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Recommended Plugins', 'shapely' ); ?></a>
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=support' ) ); ?>"
class="nav-tab <?php echo 'support' == $active_tab ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Support', 'shapely' ); ?></a>
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_plugins' ) ); ?>" class="nav-tab <?php echo 'recommended_plugins' == $active_tab ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Recommended Plugins', 'shapely' ); ?></a>
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=support' ) ); ?>" class="nav-tab <?php echo 'support' == $active_tab ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Support', 'shapely' ); ?></a>
</h2>

<?php
Expand Down
3 changes: 1 addition & 2 deletions inc/admin/welcome-screen/sections/getting-started.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
<div class="col">
<h3><?php esc_html_e( 'Step 3 - Customize everything', 'shapely' ); ?></h3>
<p><?php esc_html_e( 'Using the WordPress Customizer you can easily customize every aspect of the theme.', 'shapely' ); ?></p>
<p><a target="_blank" href="<?php echo esc_url( $customizer_url ); ?>"
class="button button-primary"><?php esc_html_e( 'Go to Customizer', 'shapely' ); ?></a>
<p><a target="_blank" href="<?php echo esc_url( $customizer_url ); ?>" class="button button-primary"><?php esc_html_e( 'Go to Customizer', 'shapely' ); ?></a>
</p>
</div><!--/.col-->
</div><!--/.feature-section-->
3 changes: 1 addition & 2 deletions inc/admin/welcome-screen/sections/support.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<p>
<i><?php esc_html_e( 'We offer excellent support through our advanced ticketing system. Make sure to register your purchase before contacting support!', 'shapely' ); ?></i>
</p>
<p><a target="_blank" class="button button-primary"
href="<?php echo esc_url( 'https://colorlib.com/wp/forums/' ); ?>"><?php esc_html_e( 'Contact Support', 'shapely' ); ?></a>
<p><a target="_blank" class="button button-primary" href="<?php echo esc_url( 'https://colorlib.com/wp/forums/' ); ?>"><?php esc_html_e( 'Contact Support', 'shapely' ); ?></a>
</p>
</div><!--/.col-->

Expand Down
2 changes: 1 addition & 1 deletion inc/class-shapely-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function get_all_pages() {
'id' => absint( $post->ID ),
'title' => esc_html( $post->post_title ),
);
$this->sidebars[] = 'shapely-' . $post->post_name;
$this->sidebars[] = 'shapely-' . $post->post_name;
}
}

Expand Down
4 changes: 1 addition & 3 deletions inc/class-shapely-related-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ function output_related_posts() {
echo '<div class="shapely-related-post-title">';

# Post Title
echo '<a href="' . esc_url( get_the_permalink() ) . '">' . wp_trim_words( get_the_title(), 5 ) .
'</a>';

echo '<a href="' . esc_url( get_the_permalink() ) . '">' . wp_trim_words( get_the_title(), 5 ) . '</a>';
echo '</div>';

}
Expand Down
3 changes: 1 addition & 2 deletions inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,7 @@ function shapely_footer_callout() {
<h3 class="cfa-text"><?php echo wp_kses_post( get_theme_mod( 'footer_callout_text' ) ); ?></h3>
</div>
<div class="col-sm-3">
<a href='<?php echo esc_url( get_theme_mod( 'footer_callout_link' ) ); ?>'
class="mb0 btn btn-lg btn-filled cfa-button">
<a href='<?php echo esc_url( get_theme_mod( 'footer_callout_link' ) ); ?>' class="mb0 btn btn-lg btn-filled cfa-button">
<?php echo wp_kses_post( get_theme_mod( 'footer_callout_btntext' ) ); ?>
</a>
</div>
Expand Down
2 changes: 0 additions & 2 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ function shapely_posted_on_no_cat() {
<?php if ( $post_date ) : ?>
<li><span class="posted-on"><?php echo $time_string; ?></span></li>
<?php endif ?>

<?php if ( $post_author ) : ?>
<li><span><?php echo esc_html__( 'by', 'shapely' ); ?> <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>"><?php esc_html( the_author() ); ?></a></span></li>
<?php endif ?>

</ul>
<?php
endif;
Expand Down
18 changes: 9 additions & 9 deletions template-parts/content-grid-small.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post-content post-grid-small col-md-6' ); ?> >
<header class="entry-header nolist">
<?php
$category = get_the_category();
$category = get_the_category();
$show_category = true;
if ( is_category() ) {
$show_category = get_theme_mod( 'show_category_on_category_page', 1 );
}
$image = '<img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder.jpg" />';
$image = '<img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder.jpg" />';
if ( has_post_thumbnail() ) {
$image = get_the_post_thumbnail( get_the_ID(), 'shapely-grid' );
}
Expand Down Expand Up @@ -63,13 +63,13 @@
the_content(
sprintf(
/* translators: %s: Name of current post. */
wp_kses(
__( 'Read more %s <span class="meta-nav">&rarr;</span>', 'shapely' ), array(
'span' => array(
'class' => array(),
),
)
),
wp_kses(
__( 'Read more %s <span class="meta-nav">&rarr;</span>', 'shapely' ), array(
'span' => array(
'class' => array(),
),
)
),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
)
);
Expand Down
18 changes: 9 additions & 9 deletions template-parts/content-grid-wide.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post-content post-grid-wide col-md-12' ); ?>>
<header class="entry-header nolist">
<?php
$category = get_the_category();
$category = get_the_category();
$show_category = true;
if ( is_category() ) {
$show_category = get_theme_mod( 'show_category_on_category_page', 1 );
}
$image = '<img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder_wide.jpg" />';
$image = '<img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder_wide.jpg" />';
if ( has_post_thumbnail() ) {
$layout = shapely_get_layout_class();
$size = 'shapely-featured';
Expand Down Expand Up @@ -70,13 +70,13 @@
the_content(
sprintf(
/* translators: %s: Name of current post. */
wp_kses(
__( 'Read more %s <span class="meta-nav">&rarr;</span>', 'shapely' ), array(
'span' => array(
'class' => array(),
),
)
),
wp_kses(
__( 'Read more %s <span class="meta-nav">&rarr;</span>', 'shapely' ), array(
'span' => array(
'class' => array(),
),
)
),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
)
);
Expand Down
13 changes: 6 additions & 7 deletions template-parts/content-portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* @package Shapely
*/

$dropcaps = get_theme_mod( 'project_first_letter_caps', true );
$enable_tags = get_theme_mod( 'project_tags_post_meta', true );
$post_author = get_theme_mod( 'project_author_area', true );
$left_side = get_theme_mod( 'project_author_left_side', false );
$post_title = get_theme_mod( 'title_above_project', true );
$post_category = get_theme_mod( 'project_category', true );
$dropcaps = get_theme_mod( 'project_first_letter_caps', true );
$enable_tags = get_theme_mod( 'project_tags_post_meta', true );
$post_author = get_theme_mod( 'project_author_area', true );
$left_side = get_theme_mod( 'project_author_left_side', false );
$post_title = get_theme_mod( 'title_above_project', true );
$post_category = get_theme_mod( 'project_category', true );

?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post-content post-grid-wide' ); ?>>
Expand Down Expand Up @@ -64,7 +64,6 @@
<a href="<?php echo esc_url( get_the_permalink() ); ?>"><?php echo wp_trim_words( get_the_title(), 9 ); ?></a>
</h2>
<?php endif ?>


<div class="entry-meta">
<?php
Expand Down
2 changes: 1 addition & 1 deletion template-parts/content-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post-content post-grid-wide col-md-12' ); ?>>
<header class="entry-header">
<?php
$image = '<img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder_wide.jpg" />';
$image = '<img class="wp-post-image" alt="" src="' . get_template_directory_uri() . '/assets/images/placeholder_wide.jpg" />';
if ( has_post_thumbnail() ) {
$layout = shapely_get_layout_class();
$size = 'shapely-featured';
Expand Down
13 changes: 6 additions & 7 deletions template-parts/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* @package Shapely
*/

$dropcaps = get_theme_mod( 'first_letter_caps', true );
$enable_tags = get_theme_mod( 'tags_post_meta', true );
$post_author = get_theme_mod( 'post_author_area', true );
$left_side = get_theme_mod( 'post_author_left_side', false );
$post_title = get_theme_mod( 'title_above_post', true );
$post_category = get_theme_mod( 'post_category', true );
$dropcaps = get_theme_mod( 'first_letter_caps', true );
$enable_tags = get_theme_mod( 'tags_post_meta', true );
$post_author = get_theme_mod( 'post_author_area', true );
$left_side = get_theme_mod( 'post_author_left_side', false );
$post_title = get_theme_mod( 'title_above_post', true );
$post_category = get_theme_mod( 'post_category', true );

?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post-content post-grid-wide' ); ?>>
Expand Down Expand Up @@ -64,7 +64,6 @@
<a href="<?php echo esc_url( get_the_permalink() ); ?>"><?php echo wp_trim_words( get_the_title(), 9 ); ?></a>
</h2>
<?php endif ?>


<div class="entry-meta">
<?php
Expand Down

0 comments on commit 286ecde

Please sign in to comment.