forked from mirror/_s
Correct code indentation
This commit is contained in:
parent
e88d9e02d9
commit
9fcb8dab40
30
comments.php
30
comments.php
|
@ -27,21 +27,21 @@ if ( post_password_required() ) {
|
||||||
if ( have_comments() ) : ?>
|
if ( have_comments() ) : ?>
|
||||||
<h2 class="comments-title">
|
<h2 class="comments-title">
|
||||||
<?php
|
<?php
|
||||||
$comment_count = get_comments_number();
|
$comment_count = get_comments_number();
|
||||||
if ( 1 === $comment_count ) {
|
if ( 1 === $comment_count ) {
|
||||||
printf(
|
printf(
|
||||||
/* translators: 1: title. */
|
/* translators: 1: title. */
|
||||||
esc_html_e( 'One thought on “%1$s”', '_s' ),
|
esc_html_e( 'One thought on “%1$s”', '_s' ),
|
||||||
'<span>' . get_the_title() . '</span>'
|
'<span>' . get_the_title() . '</span>'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
printf( // WPCS: XSS OK.
|
printf( // WPCS: XSS OK.
|
||||||
/* translators: 1: comment count number, 2: title. */
|
/* translators: 1: comment count number, 2: title. */
|
||||||
esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $comment_count, 'comments title', '_s' ) ),
|
esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $comment_count, 'comments title', '_s' ) ),
|
||||||
number_format_i18n( $comment_count ),
|
number_format_i18n( $comment_count ),
|
||||||
'<span>' . get_the_title() . '</span>'
|
'<span>' . get_the_title() . '</span>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</h2><!-- .comments-title -->
|
</h2><!-- .comments-title -->
|
||||||
|
|
||||||
|
|
138
functions.php
138
functions.php
|
@ -8,78 +8,78 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! function_exists( '_s_setup' ) ) :
|
if ( ! function_exists( '_s_setup' ) ) :
|
||||||
/**
|
|
||||||
* Sets up theme defaults and registers support for various WordPress features.
|
|
||||||
*
|
|
||||||
* Note that this function is hooked into the after_setup_theme hook, which
|
|
||||||
* runs before the init hook. The init hook is too late for some features, such
|
|
||||||
* as indicating support for post thumbnails.
|
|
||||||
*/
|
|
||||||
function _s_setup() {
|
|
||||||
/*
|
|
||||||
* Make theme available for translation.
|
|
||||||
* Translations can be filed in the /languages/ directory.
|
|
||||||
* If you're building a theme based on _s, use a find and replace
|
|
||||||
* to change '_s' to the name of your theme in all the template files.
|
|
||||||
*/
|
|
||||||
load_theme_textdomain( '_s', get_template_directory() . '/languages' );
|
|
||||||
|
|
||||||
// Add default posts and comments RSS feed links to head.
|
|
||||||
add_theme_support( 'automatic-feed-links' );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Let WordPress manage the document title.
|
|
||||||
* By adding theme support, we declare that this theme does not use a
|
|
||||||
* hard-coded <title> tag in the document head, and expect WordPress to
|
|
||||||
* provide it for us.
|
|
||||||
*/
|
|
||||||
add_theme_support( 'title-tag' );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable support for Post Thumbnails on posts and pages.
|
|
||||||
*
|
|
||||||
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
|
|
||||||
*/
|
|
||||||
add_theme_support( 'post-thumbnails' );
|
|
||||||
|
|
||||||
// This theme uses wp_nav_menu() in one location.
|
|
||||||
register_nav_menus( array(
|
|
||||||
'menu-1' => esc_html__( 'Primary', '_s' ),
|
|
||||||
) );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Switch default core markup for search form, comment form, and comments
|
|
||||||
* to output valid HTML5.
|
|
||||||
*/
|
|
||||||
add_theme_support( 'html5', array(
|
|
||||||
'search-form',
|
|
||||||
'comment-form',
|
|
||||||
'comment-list',
|
|
||||||
'gallery',
|
|
||||||
'caption',
|
|
||||||
) );
|
|
||||||
|
|
||||||
// Set up the WordPress core custom background feature.
|
|
||||||
add_theme_support( 'custom-background', apply_filters( '_s_custom_background_args', array(
|
|
||||||
'default-color' => 'ffffff',
|
|
||||||
'default-image' => '',
|
|
||||||
) ) );
|
|
||||||
|
|
||||||
// Add theme support for selective refresh for widgets.
|
|
||||||
add_theme_support( 'customize-selective-refresh-widgets' );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add support for core custom logo.
|
* Sets up theme defaults and registers support for various WordPress features.
|
||||||
*
|
*
|
||||||
* @link https://codex.wordpress.org/Theme_Logo
|
* Note that this function is hooked into the after_setup_theme hook, which
|
||||||
|
* runs before the init hook. The init hook is too late for some features, such
|
||||||
|
* as indicating support for post thumbnails.
|
||||||
*/
|
*/
|
||||||
add_theme_support( 'custom-logo', array(
|
function _s_setup() {
|
||||||
'height' => 250,
|
/*
|
||||||
'width' => 250,
|
* Make theme available for translation.
|
||||||
'flex-width' => true,
|
* Translations can be filed in the /languages/ directory.
|
||||||
'flex-height' => true,
|
* If you're building a theme based on _s, use a find and replace
|
||||||
) );
|
* to change '_s' to the name of your theme in all the template files.
|
||||||
}
|
*/
|
||||||
|
load_theme_textdomain( '_s', get_template_directory() . '/languages' );
|
||||||
|
|
||||||
|
// Add default posts and comments RSS feed links to head.
|
||||||
|
add_theme_support( 'automatic-feed-links' );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Let WordPress manage the document title.
|
||||||
|
* By adding theme support, we declare that this theme does not use a
|
||||||
|
* hard-coded <title> tag in the document head, and expect WordPress to
|
||||||
|
* provide it for us.
|
||||||
|
*/
|
||||||
|
add_theme_support( 'title-tag' );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable support for Post Thumbnails on posts and pages.
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
|
||||||
|
*/
|
||||||
|
add_theme_support( 'post-thumbnails' );
|
||||||
|
|
||||||
|
// This theme uses wp_nav_menu() in one location.
|
||||||
|
register_nav_menus( array(
|
||||||
|
'menu-1' => esc_html__( 'Primary', '_s' ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Switch default core markup for search form, comment form, and comments
|
||||||
|
* to output valid HTML5.
|
||||||
|
*/
|
||||||
|
add_theme_support( 'html5', array(
|
||||||
|
'search-form',
|
||||||
|
'comment-form',
|
||||||
|
'comment-list',
|
||||||
|
'gallery',
|
||||||
|
'caption',
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Set up the WordPress core custom background feature.
|
||||||
|
add_theme_support( 'custom-background', apply_filters( '_s_custom_background_args', array(
|
||||||
|
'default-color' => 'ffffff',
|
||||||
|
'default-image' => '',
|
||||||
|
) ) );
|
||||||
|
|
||||||
|
// Add theme support for selective refresh for widgets.
|
||||||
|
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add support for core custom logo.
|
||||||
|
*
|
||||||
|
* @link https://codex.wordpress.org/Theme_Logo
|
||||||
|
*/
|
||||||
|
add_theme_support( 'custom-logo', array(
|
||||||
|
'height' => 250,
|
||||||
|
'width' => 250,
|
||||||
|
'flex-width' => true,
|
||||||
|
'flex-height' => true,
|
||||||
|
) );
|
||||||
|
}
|
||||||
endif;
|
endif;
|
||||||
add_action( 'after_setup_theme', '_s_setup' );
|
add_action( 'after_setup_theme', '_s_setup' );
|
||||||
|
|
||||||
|
|
|
@ -29,44 +29,44 @@ function _s_custom_header_setup() {
|
||||||
add_action( 'after_setup_theme', '_s_custom_header_setup' );
|
add_action( 'after_setup_theme', '_s_custom_header_setup' );
|
||||||
|
|
||||||
if ( ! function_exists( '_s_header_style' ) ) :
|
if ( ! function_exists( '_s_header_style' ) ) :
|
||||||
/**
|
/**
|
||||||
* Styles the header image and text displayed on the blog.
|
* Styles the header image and text displayed on the blog.
|
||||||
*
|
*
|
||||||
* @see _s_custom_header_setup().
|
* @see _s_custom_header_setup().
|
||||||
*/
|
|
||||||
function _s_header_style() {
|
|
||||||
$header_text_color = get_header_textcolor();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If no custom options for text are set, let's bail.
|
|
||||||
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
|
|
||||||
*/
|
*/
|
||||||
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
|
function _s_header_style() {
|
||||||
return;
|
$header_text_color = get_header_textcolor();
|
||||||
}
|
|
||||||
|
|
||||||
// If we get this far, we have custom styles. Let's do this.
|
/*
|
||||||
?>
|
* If no custom options for text are set, let's bail.
|
||||||
<style type="text/css">
|
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
|
||||||
<?php
|
*/
|
||||||
|
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we get this far, we have custom styles. Let's do this.
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
<?php
|
||||||
// Has the text been hidden?
|
// Has the text been hidden?
|
||||||
if ( ! display_header_text() ) :
|
if ( ! display_header_text() ) :
|
||||||
?>
|
?>
|
||||||
.site-title,
|
.site-title,
|
||||||
.site-description {
|
.site-description {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
clip: rect(1px, 1px, 1px, 1px);
|
clip: rect(1px, 1px, 1px, 1px);
|
||||||
}
|
}
|
||||||
<?php
|
<?php
|
||||||
// If the user has set a custom color for the text use that.
|
// If the user has set a custom color for the text use that.
|
||||||
else :
|
else :
|
||||||
?>
|
?>
|
||||||
.site-title a,
|
.site-title a,
|
||||||
.site-description {
|
.site-description {
|
||||||
color: #<?php echo esc_attr( $header_text_color ); ?>;
|
color: #<?php echo esc_attr( $header_text_color ); ?>;
|
||||||
}
|
}
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
|
|
@ -8,68 +8,85 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! function_exists( '_s_posted_on' ) ) :
|
if ( ! function_exists( '_s_posted_on' ) ) :
|
||||||
/**
|
/**
|
||||||
* Prints HTML with meta information for the current post-date/time and author.
|
* Prints HTML with meta information for the current post-date/time and author.
|
||||||
*/
|
*/
|
||||||
function _s_posted_on() {
|
function _s_posted_on() {
|
||||||
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
||||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||||
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
|
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$time_string = sprintf( $time_string,
|
||||||
|
esc_attr( get_the_date( 'c' ) ),
|
||||||
|
esc_html( get_the_date() ),
|
||||||
|
esc_attr( get_the_modified_date( 'c' ) ),
|
||||||
|
esc_html( get_the_modified_date() )
|
||||||
|
);
|
||||||
|
|
||||||
|
$posted_on = sprintf(
|
||||||
|
/* translators: %s: post date. */
|
||||||
|
esc_html_x( 'Posted on %s', 'post date', '_s' ),
|
||||||
|
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$byline = sprintf(
|
||||||
|
/* translators: %s: post author. */
|
||||||
|
esc_html_x( 'by %s', 'post author', '_s' ),
|
||||||
|
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
||||||
|
);
|
||||||
|
|
||||||
|
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$time_string = sprintf( $time_string,
|
|
||||||
esc_attr( get_the_date( 'c' ) ),
|
|
||||||
esc_html( get_the_date() ),
|
|
||||||
esc_attr( get_the_modified_date( 'c' ) ),
|
|
||||||
esc_html( get_the_modified_date() )
|
|
||||||
);
|
|
||||||
|
|
||||||
$posted_on = sprintf(
|
|
||||||
/* translators: %s: post date. */
|
|
||||||
esc_html_x( 'Posted on %s', 'post date', '_s' ),
|
|
||||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
|
||||||
);
|
|
||||||
|
|
||||||
$byline = sprintf(
|
|
||||||
/* translators: %s: post author. */
|
|
||||||
esc_html_x( 'by %s', 'post author', '_s' ),
|
|
||||||
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
|
|
||||||
|
|
||||||
}
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( ! function_exists( '_s_entry_footer' ) ) :
|
if ( ! function_exists( '_s_entry_footer' ) ) :
|
||||||
/**
|
/**
|
||||||
* Prints HTML with meta information for the categories, tags and comments.
|
* Prints HTML with meta information for the categories, tags and comments.
|
||||||
*/
|
*/
|
||||||
function _s_entry_footer() {
|
function _s_entry_footer() {
|
||||||
// Hide category and tag text for pages.
|
// Hide category and tag text for pages.
|
||||||
if ( 'post' === get_post_type() ) {
|
if ( 'post' === get_post_type() ) {
|
||||||
/* translators: used between list items, there is a space after the comma */
|
/* translators: used between list items, there is a space after the comma */
|
||||||
$categories_list = get_the_category_list( esc_html__( ', ', '_s' ) );
|
$categories_list = get_the_category_list( esc_html__( ', ', '_s' ) );
|
||||||
if ( $categories_list ) {
|
if ( $categories_list ) {
|
||||||
/* translators: 1: list of categories. */
|
/* translators: 1: list of categories. */
|
||||||
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', '_s' ) . '</span>', $categories_list ); // WPCS: XSS OK.
|
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', '_s' ) . '</span>', $categories_list ); // WPCS: XSS OK.
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: used between list items, there is a space after the comma */
|
||||||
|
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', '_s' ) );
|
||||||
|
if ( $tags_list ) {
|
||||||
|
/* translators: 1: list of tags. */
|
||||||
|
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', '_s' ) . '</span>', $tags_list ); // WPCS: XSS OK.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* translators: used between list items, there is a space after the comma */
|
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
||||||
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', '_s' ) );
|
echo '<span class="comments-link">';
|
||||||
if ( $tags_list ) {
|
comments_popup_link(
|
||||||
/* translators: 1: list of tags. */
|
sprintf(
|
||||||
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', '_s' ) . '</span>', $tags_list ); // WPCS: XSS OK.
|
wp_kses(
|
||||||
|
/* translators: %s: post title */
|
||||||
|
__( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', '_s' ),
|
||||||
|
array(
|
||||||
|
'span' => array(
|
||||||
|
'class' => array(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
get_the_title()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
echo '</span>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
edit_post_link(
|
||||||
echo '<span class="comments-link">';
|
|
||||||
comments_popup_link(
|
|
||||||
sprintf(
|
sprintf(
|
||||||
wp_kses(
|
wp_kses(
|
||||||
/* translators: %s: post title */
|
/* translators: %s: Name of current post. Only visible to screen readers */
|
||||||
__( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', '_s' ),
|
__( 'Edit <span class="screen-reader-text">%s</span>', '_s' ),
|
||||||
array(
|
array(
|
||||||
'span' => array(
|
'span' => array(
|
||||||
'class' => array(),
|
'class' => array(),
|
||||||
|
@ -77,26 +94,9 @@ function _s_entry_footer() {
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
get_the_title()
|
get_the_title()
|
||||||
)
|
|
||||||
);
|
|
||||||
echo '</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
edit_post_link(
|
|
||||||
sprintf(
|
|
||||||
wp_kses(
|
|
||||||
/* translators: %s: Name of current post. Only visible to screen readers */
|
|
||||||
__( 'Edit <span class="screen-reader-text">%s</span>', '_s' ),
|
|
||||||
array(
|
|
||||||
'span' => array(
|
|
||||||
'class' => array(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
get_the_title()
|
'<span class="edit-link">',
|
||||||
),
|
'</span>'
|
||||||
'<span class="edit-link">',
|
);
|
||||||
'</span>'
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
endif;
|
endif;
|
||||||
|
|
Reference in New Issue