Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahmonster committed Oct 7, 2015
1 parent 3607244 commit 8c38937
Show file tree
Hide file tree
Showing 14 changed files with 305 additions and 359 deletions.
18 changes: 9 additions & 9 deletions components/content-excerpt.php
Expand Up @@ -11,19 +11,19 @@

<header class="entry-header">
<?php
if ( has_post_thumbnail() ) :
printf( '<a href="%1$s" rel="bookmark" title="%2$s">',
esc_url( get_permalink() ),
esc_attr( get_the_title() )
);
the_post_thumbnail( 'pique-strip' );
echo '</a>';
endif;
if ( has_post_thumbnail() ) :
printf( '<a href="%1$s" rel="bookmark" title="%2$s">',
esc_url( get_permalink() ),
esc_attr( get_the_title() )
);
the_post_thumbnail( 'pique-strip' );
echo '</a>';
endif;
?>

<?php the_title( sprintf( '<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' ); ?>

<?php if ( 'post' == get_post_type() ) : ?>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<?php pique_posted_on(); ?>
</div><!-- .entry-meta -->
Expand Down
91 changes: 43 additions & 48 deletions components/content-front.php
Expand Up @@ -4,15 +4,9 @@
*
* @package Pique
*/

if ( isset( $count ) ):
$count++;
else:
$count = 1;
endif;
?>

<article id="post-<?php the_ID(); ?>" <?php post_class( 'pique-panel' ); ?> data-slide="<?php echo $count; ?>" data-stellar-background-ratio="0.5">
<article id="post-<?php the_ID(); ?>" <?php post_class( 'pique-panel' ); ?>>
<?php if ( has_post_thumbnail() ) :
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'pique-hero' ); ?>
<div class="pique-panel-background" style="background-image:url(<?php echo esc_url( $thumbnail[0] ); ?>)"></div>
Expand All @@ -21,7 +15,7 @@
<header class="entry-header">
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>

<?php if ( 'post' == get_post_type() ) : ?>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<?php pique_posted_on(); ?>
</div><!-- .entry-meta -->
Expand All @@ -37,55 +31,56 @@
) );
?>

<?php // Show recent blog posts for blog panel (Note that get_option returns a string, so we're casting the result as an int)
if( get_the_ID() === (int)get_option( 'page_for_posts' ) ): ?>
<?php
// Show recent blog posts for blog panel (Note that get_option returns a string, so we're casting the result as an int)
if ( get_the_ID() === (int) get_option( 'page_for_posts' ) ) : ?>

<div class="pique-recent-posts pique-grid-two">
<div class="pique-recent-posts pique-grid-two">

<?php // Show four most recent posts
$pique_recent_posts = wp_get_recent_posts( array(
'numberposts' => 4,
'post_status' => 'publish',
), OBJECT );
<?php // Show four most recent posts
$pique_recent_posts = wp_get_recent_posts( array(
'numberposts' => 4,
'post_status' => 'publish',
), OBJECT );

get_posts( $pique_recent_posts );
get_posts( $pique_recent_posts );

foreach ( $pique_recent_posts as $post):
setup_postdata( $post);
get_template_part( 'components/content', 'excerpt' );
wp_reset_postdata();
endforeach; ?>
</div><!-- .pique-recent-posts -->
<?php endif; ?>
foreach ( $pique_recent_posts as $post ) :
setup_postdata( $post );
get_template_part( 'components/content', 'excerpt' );
wp_reset_postdata();
endforeach; ?>
</div><!-- .pique-recent-posts -->
<?php endif; ?>

<?php // Show sub-pages of grid template page
if ( 'page-templates/template-grid.php' === get_page_template_slug() ) :
get_template_part( 'components/content', 'grid' );
endif;
if ( 'page-templates/template-grid.php' === get_page_template_slug() ) :
get_template_part( 'components/content', 'grid' );
endif;

// Show testimonials
if ( 'page-templates/template-testimonials.php' === get_page_template_slug() ) :
// Show two random testimonials
$testimonials = new WP_Query( array(
'post_type' => 'jetpack-testimonial',
'order' => 'ASC',
'orderby' => 'rand',
'posts_per_page' => 2,
'no_found_rows' => true,
) );
?>
// Show testimonials
if ( 'page-templates/template-testimonials.php' === get_page_template_slug() ) :
// Show two random testimonials
$testimonials = new WP_Query( array(
'post_type' => 'jetpack-testimonial',
'order' => 'ASC',
'orderby' => 'rand',
'posts_per_page' => 2,
'no_found_rows' => true,
) );
?>

<?php if ( $testimonials->have_posts() ) : ?>
<div class="pique-testimonials pique-grid-two">
<?php
while ( $testimonials->have_posts() ) : $testimonials->the_post();
get_template_part( 'components/content', 'testimonial' );
endwhile;
wp_reset_postdata();
?>
</div><!-- .pique-testimonials -->
<?php endif; ?>
<?php if ( $testimonials->have_posts() ) : ?>
<div class="pique-testimonials pique-grid-two">
<?php
while ( $testimonials->have_posts() ) : $testimonials->the_post();
get_template_part( 'components/content', 'testimonial' );
endwhile;
wp_reset_postdata();
?>
</div><!-- .pique-testimonials -->
<?php endif; ?>
<?php endif; ?>

<?php
wp_link_pages( array(
Expand Down
56 changes: 28 additions & 28 deletions components/content-grid.php
Expand Up @@ -6,41 +6,41 @@
*/
?>

<?php
$pique_child_pages = new WP_Query( array(
'post_type' => 'page',
'orderby' => 'menu_order',
'order' => 'ASC',
'post_parent' => $post->ID,
'posts_per_page' => 999,
'no_found_rows' => true,
) );
?>
<?php
$pique_child_pages = new WP_Query( array(
'post_type' => 'page',
'orderby' => 'menu_order',
'order' => 'ASC',
'post_parent' => $post->ID,
'posts_per_page' => 12,
'no_found_rows' => true,
) );
?>

<?php if ( $pique_child_pages->have_posts() ) : ?>
<?php if ( $pique_child_pages->have_posts() ) : ?>

<div class="pique-grid-three">
<div class="pique-grid-three">

<?php while ( $pique_child_pages->have_posts() ) : $pique_child_pages->the_post(); ?>
<?php while ( $pique_child_pages->have_posts() ) : $pique_child_pages->the_post(); ?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail( 'pique-square' );
endif;
?>
<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail( 'pique-square' );
endif;
?>

<?php the_title( '<h3>' , '</h3>' ); ?>
<?php the_title( '<h3>' , '</h3>' ); ?>

<?php the_content(); ?>
</article>
<?php the_content(); ?>
</article>

<?php endwhile; ?>
<?php endwhile; ?>

</div><!-- .child-pages .grid -->
</div><!-- .child-pages .grid -->

<?php
endif;
wp_reset_postdata();
?>
<?php
endif;
wp_reset_postdata();
?>
41 changes: 22 additions & 19 deletions components/content-hero.php
Expand Up @@ -6,26 +6,29 @@
*/
?>

<article id="pique-hero" <?php post_class( 'pique-panel pique-hero' ); ?> data-slide="1" data-stellar-background-ratio="0.5">
<?php if ( has_post_thumbnail() ) :
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'pique-hero' ); ?>
<div class="pique-panel-background" style="background-image:url(<?php echo esc_url( $thumbnail[0] ); ?>)"></div>
<?php endif; ?>
<div class="pique-panel-content">
<article id="pique-hero" <?php post_class( 'pique-panel pique-hero' ); ?>>
<?php if ( has_post_thumbnail() ) :
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'pique-hero' ); ?>
<div class="pique-panel-background" style="background-image:url(<?php echo esc_url( $thumbnail[0] ); ?>)"></div>
<?php endif; ?>

<div class="entry-content">
<div class="pique-panel-content">

<?php
/* translators: %s: Name of current post */
the_content( sprintf(
wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'pique' ), array( 'span' => array( 'class' => array() ) ) ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
) );
?>
</div><!-- .entry-content -->
<div class="entry-content">

<?php
/* translators: %s: Name of current post */
the_content( sprintf(
wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'pique' ), array( 'span' => array( 'class' => array() ) ) ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
) );
?>
</div><!-- .entry-content -->

</div><!-- .pique-panel-content -->

<footer class="entry-footer">
<?php pique_entry_footer(); ?>
</footer><!-- .entry-footer -->

</div><!-- .pique-panel-content -->
<footer class="entry-footer">
<?php pique_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
4 changes: 1 addition & 3 deletions components/content-search.php
Expand Up @@ -13,7 +13,7 @@
<header class="entry-header">
<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>

<?php if ( 'post' == get_post_type() ) : ?>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<?php pique_posted_on(); ?>
</div><!-- .entry-meta -->
Expand All @@ -28,5 +28,3 @@
<?php pique_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->


2 changes: 1 addition & 1 deletion footer.php
Expand Up @@ -24,7 +24,7 @@
<div class="site-info">
<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'pique' ) ); ?>"><?php printf( esc_html__( 'Proudly powered by %s', 'pique' ), 'WordPress' ); ?></a>
<span class="sep"> &middot; </span>
<?php printf( esc_html__( 'Theme: %1$s by %2$s.', 'pique' ), 'Pique', '<a href="http://wordpress.com/themes" rel="designer">Automattic</a>' ); ?>
<?php printf( esc_html__( 'Theme: %1$s by %2$s.', 'pique' ), 'Pique', '<a href="http://wordpress.com/themes" rel="designer">WordPress.com</a>' ); ?>
</div><!-- .site-info -->

</footer><!-- #colophon -->
Expand Down

0 comments on commit 8c38937

Please sign in to comment.