forked from mirror/_s
Merge pull request #859 from jrfnl/feature/854-no-unncessary-php-tags
Avoid going in and out of PHP unnecessarily.
This commit is contained in:
commit
193d073b84
19
404.php
19
404.php
|
@ -20,11 +20,14 @@ get_header(); ?>
|
|||
<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?', '_s' ); ?></p>
|
||||
|
||||
<?php get_search_form(); ?>
|
||||
<?php
|
||||
get_search_form();
|
||||
|
||||
<?php the_widget( 'WP_Widget_Recent_Posts' ); ?>
|
||||
the_widget( 'WP_Widget_Recent_Posts' );
|
||||
|
||||
if ( _s_categorized_blog() ) : // Only show the widget if site has multiple categories.
|
||||
?>
|
||||
|
||||
<?php if ( _s_categorized_blog() ) : // Only show the widget if site has multiple categories. ?>
|
||||
<div class="widget widget_categories">
|
||||
<h2 class="widget-title"><?php esc_html_e( 'Most Used Categories', '_s' ); ?></h2>
|
||||
<ul>
|
||||
|
@ -39,15 +42,16 @@ get_header(); ?>
|
|||
?>
|
||||
</ul>
|
||||
</div><!-- .widget -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
|
||||
/* translators: %1$s: smiley */
|
||||
$archive_content = '<p>' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', '_s' ), convert_smilies( ':)' ) ) . '</p>';
|
||||
the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=</h2>$archive_content" );
|
||||
?>
|
||||
|
||||
<?php the_widget( 'WP_Widget_Tag_Cloud' ); ?>
|
||||
the_widget( 'WP_Widget_Tag_Cloud' );
|
||||
?>
|
||||
|
||||
</div><!-- .page-content -->
|
||||
</section><!-- .error-404 -->
|
||||
|
@ -55,4 +59,5 @@ get_header(); ?>
|
|||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php get_footer(); ?>
|
||||
<?php
|
||||
get_footer();
|
||||
|
|
38
archive.php
38
archive.php
|
@ -12,7 +12,8 @@ get_header(); ?>
|
|||
<div id="primary" class="content-area">
|
||||
<main id="main" class="site-main" role="main">
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<?php
|
||||
if ( have_posts() ) : ?>
|
||||
|
||||
<header class="page-header">
|
||||
<?php
|
||||
|
@ -21,31 +22,30 @@ get_header(); ?>
|
|||
?>
|
||||
</header><!-- .page-header -->
|
||||
|
||||
<?php /* Start the Loop */ ?>
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
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( 'template-parts/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() );
|
||||
?>
|
||||
endwhile;
|
||||
|
||||
<?php endwhile; ?>
|
||||
the_posts_navigation();
|
||||
|
||||
<?php the_posts_navigation(); ?>
|
||||
else :
|
||||
|
||||
<?php else : ?>
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
|
||||
<?php get_template_part( 'template-parts/content', 'none' ); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
endif; ?>
|
||||
|
||||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
<?php get_footer(); ?>
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
25
comments.php
25
comments.php
|
@ -22,9 +22,9 @@ if ( post_password_required() ) {
|
|||
|
||||
<div id="comments" class="comments-area">
|
||||
|
||||
<?php // You can start editing here -- including this comment! ?>
|
||||
|
||||
<?php if ( have_comments() ) : ?>
|
||||
<?php
|
||||
// You can start editing here -- including this comment!
|
||||
if ( have_comments() ) : ?>
|
||||
<h2 class="comments-title">
|
||||
<?php
|
||||
printf( // WPCS: XSS OK.
|
||||
|
@ -66,17 +66,20 @@ if ( post_password_required() ) {
|
|||
|
||||
</div><!-- .nav-links -->
|
||||
</nav><!-- #comment-nav-below -->
|
||||
<?php endif; // Check for comment navigation. ?>
|
||||
<?php
|
||||
endif; // Check for comment navigation.
|
||||
|
||||
<?php endif; // Check for have_comments(). ?>
|
||||
endif; // Check for have_comments().
|
||||
|
||||
|
||||
// If comments are closed and there are comments, let's leave a little note, shall we?
|
||||
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
|
||||
|
||||
<?php
|
||||
// If comments are closed and there are comments, let's leave a little note, shall we?
|
||||
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
|
||||
?>
|
||||
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', '_s' ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
<?php comment_form(); ?>
|
||||
comment_form();
|
||||
?>
|
||||
|
||||
</div><!-- #comments -->
|
||||
|
|
|
@ -26,16 +26,19 @@
|
|||
|
||||
<header id="masthead" class="site-header" role="banner">
|
||||
<div class="site-branding">
|
||||
<?php if ( is_front_page() && is_home() ) : ?>
|
||||
<?php
|
||||
if ( is_front_page() && is_home() ) : ?>
|
||||
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php else : ?>
|
||||
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php endif;
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$description = get_bloginfo( 'description', 'display' );
|
||||
if ( $description || is_customize_preview() ) : ?>
|
||||
<p class="site-description"><?php echo $description; /* WPCS: xss ok. */ ?></p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
endif; ?>
|
||||
</div><!-- .site-branding -->
|
||||
|
||||
<nav id="site-navigation" class="main-navigation" role="navigation">
|
||||
|
|
41
index.php
41
index.php
|
@ -17,39 +17,40 @@ get_header(); ?>
|
|||
<div id="primary" class="content-area">
|
||||
<main id="main" class="site-main" role="main">
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<?php
|
||||
if ( have_posts() ) :
|
||||
|
||||
<?php if ( is_home() && ! is_front_page() ) : ?>
|
||||
if ( is_home() && ! is_front_page() ) : ?>
|
||||
<header>
|
||||
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php /* Start the Loop */ ?>
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
while ( have_posts() ) : the_post();
|
||||
|
||||
/*
|
||||
* 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() );
|
||||
?>
|
||||
/*
|
||||
* 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; ?>
|
||||
endwhile;
|
||||
|
||||
<?php the_posts_navigation(); ?>
|
||||
the_posts_navigation();
|
||||
|
||||
<?php else : ?>
|
||||
else :
|
||||
|
||||
<?php get_template_part( 'template-parts/content', 'none' ); ?>
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
|
||||
<?php endif; ?>
|
||||
endif; ?>
|
||||
|
||||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
<?php get_footer(); ?>
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
23
page.php
23
page.php
|
@ -17,21 +17,22 @@ get_header(); ?>
|
|||
<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( 'template-parts/content', 'page' ); ?>
|
||||
get_template_part( 'template-parts/content', 'page' );
|
||||
|
||||
<?php
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
if ( comments_open() || get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
?>
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
if ( comments_open() || get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
|
||||
<?php endwhile; // End of the loop. ?>
|
||||
endwhile; // End of the loop.
|
||||
?>
|
||||
|
||||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
<?php get_footer(); ?>
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
25
search.php
25
search.php
|
@ -12,36 +12,37 @@ get_header(); ?>
|
|||
<section id="primary" class="content-area">
|
||||
<main id="main" class="site-main" role="main">
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<?php
|
||||
if ( have_posts() ) : ?>
|
||||
|
||||
<header class="page-header">
|
||||
<h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', '_s' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
|
||||
</header><!-- .page-header -->
|
||||
|
||||
<?php /* Start the Loop */ ?>
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
while ( have_posts() ) : the_post();
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Run the loop for the search to output the results.
|
||||
* 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( 'template-parts/content', 'search' );
|
||||
?>
|
||||
|
||||
<?php endwhile; ?>
|
||||
endwhile;
|
||||
|
||||
<?php the_posts_navigation(); ?>
|
||||
the_posts_navigation();
|
||||
|
||||
<?php else : ?>
|
||||
else :
|
||||
|
||||
<?php get_template_part( 'template-parts/content', 'none' ); ?>
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
|
||||
<?php endif; ?>
|
||||
endif; ?>
|
||||
|
||||
</main><!-- #main -->
|
||||
</section><!-- #primary -->
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
<?php get_footer(); ?>
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
25
single.php
25
single.php
|
@ -12,23 +12,24 @@ get_header(); ?>
|
|||
<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( 'template-parts/content', 'single' ); ?>
|
||||
get_template_part( 'template-parts/content', 'single' );
|
||||
|
||||
<?php the_post_navigation(); ?>
|
||||
the_post_navigation();
|
||||
|
||||
<?php
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
if ( comments_open() || get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
?>
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
if ( comments_open() || get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
|
||||
<?php endwhile; // End of the loop. ?>
|
||||
endwhile; // End of the loop.
|
||||
?>
|
||||
|
||||
</main><!-- #main -->
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
<?php get_footer(); ?>
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
|
@ -15,20 +15,23 @@
|
|||
</header><!-- .page-header -->
|
||||
|
||||
<div class="page-content">
|
||||
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
|
||||
<?php
|
||||
if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
|
||||
|
||||
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', '_s' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
|
||||
|
||||
<?php elseif ( is_search() ) : ?>
|
||||
|
||||
<p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', '_s' ); ?></p>
|
||||
<?php get_search_form(); ?>
|
||||
<?php
|
||||
get_search_form();
|
||||
|
||||
<?php else : ?>
|
||||
else : ?>
|
||||
|
||||
<p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', '_s' ); ?></p>
|
||||
<?php get_search_form(); ?>
|
||||
<?php
|
||||
get_search_form();
|
||||
|
||||
<?php endif; ?>
|
||||
endif; ?>
|
||||
</div><!-- .page-content -->
|
||||
</section><!-- .no-results -->
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="entry-content">
|
||||
<?php the_content(); ?>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', '_s' ),
|
||||
'after' => '</div>',
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="entry-content">
|
||||
<?php the_content(); ?>
|
||||
<?php
|
||||
the_content();
|
||||
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', '_s' ),
|
||||
'after' => '</div>',
|
||||
|
|
|
@ -11,13 +11,15 @@
|
|||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<header class="entry-header">
|
||||
<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
|
||||
<?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() ) : ?>
|
||||
if ( 'post' === get_post_type() ) : ?>
|
||||
<div class="entry-meta">
|
||||
<?php _s_posted_on(); ?>
|
||||
</div><!-- .entry-meta -->
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
endif; ?>
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="entry-content">
|
||||
|
@ -27,9 +29,7 @@
|
|||
wp_kses( __( 'Continue reading %s <span class="meta-nav">→</span>', '_s' ), array( 'span' => array( 'class' => array() ) ) ),
|
||||
the_title( '<span class="screen-reader-text">"', '"</span>', false )
|
||||
) );
|
||||
?>
|
||||
|
||||
<?php
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', '_s' ),
|
||||
'after' => '</div>',
|
||||
|
|
Reference in New Issue