diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 84c9893..758a572 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -43,8 +43,8 @@ People *love* thorough bug reports. I'm not even kidding.
## Use a Consistent Coding Style
-* 2 spaces for indentation rather than tabs
-* Use ./.editorconfig if your editor supports it
+* Stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/)
+* Use [./.editorconfig](https://github.com/understrap/understrap/blob/master/.editorconfig) if your editor supports it
## License
diff --git a/404.php b/404.php
index 2298a86..8d28c1b 100644
--- a/404.php
+++ b/404.php
@@ -49,11 +49,11 @@ $container = get_theme_mod( 'understrap_container_type' );
'count',
- 'order' => 'DESC',
+ 'orderby' => 'count',
+ 'order' => 'DESC',
'show_count' => 1,
- 'title_li' => '',
- 'number' => 10,
+ 'title_li' => '',
+ 'number' => 10,
)
);
?>
@@ -86,4 +86,5 @@ $container = get_theme_mod( 'understrap_container_type' );
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+ }
+ } else {
+ get_template_part( 'loop-templates/content', 'none' );
+ }
+ ?>
-
-
+
-
-
-
-
+
-
+
-
nickname ); ?>
- ID ) ) : ?>
- ID ); ?>
-
+ ID ) ) {
+ echo get_avatar( $curauth->ID );
+ }
+ ?>
user_url ) || ! empty( $curauth->user_description ) ) : ?>
@@ -52,45 +54,39 @@ $container = get_theme_mod( 'understrap_container_type' );
user_description ) ) : ?>
- user_description, 'understrap' ); ?>
+ user_description ); ?>
- nickname ); ?>:
+ nickname ); ?>:
-
-
-
-
-
-
- ';
+ while ( have_posts() ) {
+ the_post();
+ echo ' ';
printf(
'%3$s ',
esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) ),
esc_attr( __( 'Permanent Link:', 'understrap' ) ),
- the_title( '', '', false )
+ get_the_title()
);
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
+ understrap_posted_on();
+ esc_html_e( 'in', 'understrap' );
+ the_category( '&' );
+ echo '';
+ }
+ echo ' ';
+ } else {
+ get_template_part( 'loop-templates/content', 'none' );
+ }
+ ?>
-
-
@@ -105,4 +101,5 @@ $container = get_theme_mod( 'understrap_container_type' );
-
-
+if ( is_active_sidebar( 'hero' ) || is_active_sidebar( 'statichero' ) || is_active_sidebar( 'herocanvas' ) ) :
+ ?>
-
-
-
-
-
+
-
-
-
-
-
diff --git a/global-templates/right-sidebar-check.php b/global-templates/right-sidebar-check.php
index 90af56e..b085e46 100644
--- a/global-templates/right-sidebar-check.php
+++ b/global-templates/right-sidebar-check.php
@@ -11,10 +11,9 @@ defined( 'ABSPATH' ) || exit;
-
+
-
-
-
-
-
+ }
+ ?>
+
- 'primary',
'container_class' => 'collapse navbar-collapse',
@@ -73,7 +77,8 @@ $container = get_theme_mod( 'understrap_container_type' );
'depth' => 2,
'walker' => new Understrap_WP_Bootstrap_Navwalker(),
)
- ); ?>
+ );
+ ?>
diff --git a/inc/class-wp-bootstrap-navwalker.php b/inc/class-wp-bootstrap-navwalker.php
index aee0413..139bff9 100644
--- a/inc/class-wp-bootstrap-navwalker.php
+++ b/inc/class-wp-bootstrap-navwalker.php
@@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit;
* GitHub Branch: master
* License: GPL-3.0+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
-*/
+ */
/* Check if Class Exists. */
if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) {
@@ -182,7 +182,7 @@ if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) {
}
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
- if ( '_blank' === $item->target && empty( $item->xfn ) ) { // Thanks to LukaszJaro, see https://github.com/understrap/understrap/issues/973
+ if ( '_blank' === $item->target && empty( $item->xfn ) ) { // Thanks to LukaszJaro, see https://github.com/understrap/understrap/issues/973.
$atts['rel'] = 'noopener noreferrer';
} else {
$atts['rel'] = $item->xfn;
@@ -381,7 +381,7 @@ if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) {
// if $args has 'echo' key and it's true echo, otherwise return.
if ( array_key_exists( 'echo', $args ) && $args['echo'] ) {
- echo $fallback_output; // WPCS: XSS OK.
+ echo $fallback_output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $fallback_output;
}
diff --git a/inc/custom-header.php b/inc/custom-header.php
index 06336e1..fd4e86c 100644
--- a/inc/custom-header.php
+++ b/inc/custom-header.php
@@ -11,6 +11,9 @@ defined( 'ABSPATH' ) || exit;
add_action( 'after_setup_theme', 'understrap_custom_header_setup' );
if ( ! function_exists( 'understrap_custom_header_setup' ) ) {
+ /**
+ * Set up custom header feature.
+ */
function understrap_custom_header_setup() {
/**
diff --git a/inc/customizer.php b/inc/customizer.php
index 25a9edb..46ee949 100644
--- a/inc/customizer.php
+++ b/inc/customizer.php
@@ -130,7 +130,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
)
);
}
-} // endif function_exists( 'understrap_theme_customize_register' ).
+} // End of if function_exists( 'understrap_theme_customize_register' ).
add_action( 'customize_register', 'understrap_theme_customize_register' );
/**
diff --git a/inc/deprecated.php b/inc/deprecated.php
index b9a5db6..6ccabb5 100644
--- a/inc/deprecated.php
+++ b/inc/deprecated.php
@@ -21,26 +21,26 @@ if ( ! function_exists( 'understrap_slbd_count_widgets' ) ) {
// to see if wp_convert_widget_settings() has made manipulations in memory.
global $_wp_sidebars_widgets;
if ( empty( $_wp_sidebars_widgets ) ) :
- $_wp_sidebars_widgets = get_option( 'sidebars_widgets', array() );
+ $_wp_sidebars_widgets = get_option( 'sidebars_widgets', array() ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
endif;
$sidebars_widgets_count = $_wp_sidebars_widgets;
if ( isset( $sidebars_widgets_count[ $sidebar_id ] ) ) :
- $widget_count = count( $sidebars_widgets_count[ $sidebar_id ] );
+ $widget_count = count( $sidebars_widgets_count[ $sidebar_id ] );
$widget_classes = 'widget-count-' . count( $sidebars_widgets_count[ $sidebar_id ] );
- if ( 0 == $widget_count % 4 || $widget_count > 6 ) :
- // Four widgets per row if there are exactly four or more than six
+ if ( 0 == $widget_count % 4 || $widget_count > 6 ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ // Four widgets per row if there are exactly four or more than six.
$widget_classes .= ' col-md-3';
- elseif ( 6 == $widget_count ) :
- // If two widgets are published
+ elseif ( 6 == $widget_count ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ // If two widgets are published.
$widget_classes .= ' col-md-2';
elseif ( $widget_count >= 3 ) :
- // Three widgets per row if there's three or more widgets
+ // Three widgets per row if there's three or more widgets.
$widget_classes .= ' col-md-4';
- elseif ( 2 == $widget_count ) :
- // If two widgets are published
+ elseif ( 2 == $widget_count ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ // If two widgets are published.
$widget_classes .= ' col-md-6';
- elseif ( 1 == $widget_count ) :
- // If just on widget is active
+ elseif ( 1 == $widget_count ) : // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ // If just on widget is active.
$widget_classes .= ' col-md-12';
endif;
return $widget_classes;
diff --git a/inc/editor.php b/inc/editor.php
index f3c6599..c46fb61 100644
--- a/inc/editor.php
+++ b/inc/editor.php
@@ -24,7 +24,7 @@ add_filter( 'mce_buttons_2', 'understrap_tiny_mce_style_formats' );
if ( ! function_exists( 'understrap_tiny_mce_style_formats' ) ) {
/**
* Reveals TinyMCE's hidden Style dropdown.
- *
+ *
* @param array $buttons Array of Tiny MCE's button ids.
* @return array
*/
diff --git a/inc/enqueue.php b/inc/enqueue.php
index fdb6921..8bcc6ce 100644
--- a/inc/enqueue.php
+++ b/inc/enqueue.php
@@ -28,6 +28,6 @@ if ( ! function_exists( 'understrap_scripts' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
-} // endif function_exists( 'understrap_scripts' ).
+} // End of if function_exists( 'understrap_scripts' ).
add_action( 'wp_enqueue_scripts', 'understrap_scripts' );
diff --git a/inc/extras.php b/inc/extras.php
index 893e251..e1a76fd 100644
--- a/inc/extras.php
+++ b/inc/extras.php
@@ -48,7 +48,7 @@ if ( ! function_exists( 'understrap_adjust_body_class' ) ) {
function understrap_adjust_body_class( $classes ) {
foreach ( $classes as $key => $value ) {
- if ( 'tag' == $value ) {
+ if ( 'tag' === $value ) {
unset( $classes[ $key ] );
}
}
@@ -67,7 +67,7 @@ if ( ! function_exists( 'understrap_change_logo_class' ) ) {
*
* @param string $html Markup.
*
- * @return mixed
+ * @return string
*/
function understrap_change_logo_class( $html ) {
@@ -79,11 +79,10 @@ if ( ! function_exists( 'understrap_change_logo_class' ) ) {
}
}
-/**
- * Display navigation to next/previous post when applicable.
- */
-
if ( ! function_exists( 'understrap_post_nav' ) ) {
+ /**
+ * Display navigation to next/previous post when applicable.
+ */
function understrap_post_nav() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
@@ -148,3 +147,108 @@ if ( ! function_exists( 'understrap_default_body_attributes' ) ) {
}
}
add_filter( 'understrap_body_attributes', 'understrap_default_body_attributes' );
+
+// Escapes all occurances of 'the_archive_description'.
+add_filter( 'get_the_archive_description', 'understrap_escape_the_archive_description' );
+
+if ( ! function_exists( 'understrap_escape_the_archive_description' ) ) {
+ /**
+ * Escapes the description for an author or post type archive.
+ *
+ * @param string $description Archive description.
+ * @return string Maybe escaped $description.
+ */
+ function understrap_escape_the_archive_description( $description ) {
+ if ( is_author() || is_post_type_archive() ) {
+ return wp_kses_post( $description );
+ } else {
+ /*
+ * All other descriptions are retrieved via term_description() which returns
+ * a sanitized description.
+ */
+ return $description;
+ }
+ }
+} // End of if function_exists( 'understrap_escape_the_archive_description' ).
+
+// Escapes all occurances of 'the_title()' and 'get_the_title()'.
+add_filter( 'the_title', 'understrap_kses_title' );
+
+// Escapes all occurances of 'the_archive_title' and 'get_the_archive_title()'.
+add_filter( 'get_the_archive_title', 'understrap_kses_title' );
+
+if ( ! function_exists( 'understrap_kses_title' ) ) {
+ /**
+ * Sanitizes data for allowed HTML tags for post title.
+ *
+ * @param string $data Post title to filter.
+ * @return string Filtered post title with allowed HTML tags and attributes intact.
+ */
+ function understrap_kses_title( $data ) {
+ // Tags not supported in HTML5 are not allowed.
+ $allowed_tags = array(
+ 'abbr' => array(),
+ 'aria-describedby' => true,
+ 'aria-details' => true,
+ 'aria-label' => true,
+ 'aria-labelledby' => true,
+ 'aria-hidden' => true,
+ 'b' => array(),
+ 'bdo' => array(
+ 'dir' => true,
+ ),
+ 'blockquote' => array(
+ 'cite' => true,
+ 'lang' => true,
+ 'xml:lang' => true,
+ ),
+ 'cite' => array(
+ 'dir' => true,
+ 'lang' => true,
+ ),
+ 'dfn' => array(),
+ 'em' => array(),
+ 'i' => array(
+ 'aria-describedby' => true,
+ 'aria-details' => true,
+ 'aria-label' => true,
+ 'aria-labelledby' => true,
+ 'aria-hidden' => true,
+ 'class' => true,
+ ),
+ 'code' => array(),
+ 'del' => array(
+ 'datetime' => true,
+ ),
+ 'ins' => array(
+ 'datetime' => true,
+ 'cite' => true,
+ ),
+ 'kbd' => array(),
+ 'mark' => array(),
+ 'pre' => array(
+ 'width' => true,
+ ),
+ 'q' => array(
+ 'cite' => true,
+ ),
+ 's' => array(),
+ 'samp' => array(),
+ 'span' => array(
+ 'dir' => true,
+ 'align' => true,
+ 'lang' => true,
+ 'xml:lang' => true,
+ ),
+ 'small' => array(),
+ 'strong' => array(),
+ 'sub' => array(),
+ 'sup' => array(),
+ 'u' => array(),
+ 'var' => array(),
+ );
+ $allowed_tags = apply_filters( 'understrap_kses_title', $allowed_tags );
+
+ return wp_kses( $data, $allowed_tags );
+ }
+} // End of if function_exists( 'understrap_kses_title' ).
diff --git a/inc/hooks.php b/inc/hooks.php
index a3f854d..f91daee 100644
--- a/inc/hooks.php
+++ b/inc/hooks.php
@@ -29,23 +29,23 @@ if ( ! function_exists( 'understrap_add_site_info' ) ) {
'%2$s | %3$s(%4$s)',
esc_url( __( 'http://wordpress.org/', 'understrap' ) ),
sprintf(
- /* translators:*/
+ /* translators: WordPress */
esc_html__( 'Proudly powered by %s', 'understrap' ),
'WordPress'
),
sprintf( // WPCS: XSS ok.
- /* translators:*/
+ /* translators: 1: Theme name, 2: Theme author */
esc_html__( 'Theme: %1$s by %2$s.', 'understrap' ),
$the_theme->get( 'Name' ),
'understrap.com '
),
sprintf( // WPCS: XSS ok.
- /* translators:*/
+ /* translators: Theme version */
esc_html__( 'Version: %1$s', 'understrap' ),
$the_theme->get( 'Version' )
)
);
- echo apply_filters( 'understrap_site_info_content', $site_info ); // WPCS: XSS ok.
+ echo apply_filters( 'understrap_site_info_content', $site_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
diff --git a/inc/jetpack.php b/inc/jetpack.php
index f91982f..5d60333 100644
--- a/inc/jetpack.php
+++ b/inc/jetpack.php
@@ -10,16 +10,16 @@
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
-/**
- * Jetpack setup function.
- *
- * See: https://jetpack.me/support/infinite-scroll/
- * See: https://jetpack.me/support/responsive-videos/
- */
-
add_action( 'after_setup_theme', 'understrap_components_jetpack_setup' );
if ( ! function_exists( 'understrap_components_jetpack_setup' ) ) {
+ /**
+ * Jetpack setup function.
+ *
+ * @link https://jetpack.me/support/infinite-scroll/
+ * @link https://jetpack.me/support/responsive-videos/
+ * @link https://jetpack.me/support/social-menu/
+ */
function understrap_components_jetpack_setup() {
// Add theme support for Infinite Scroll.
add_theme_support(
@@ -34,18 +34,16 @@ if ( ! function_exists( 'understrap_components_jetpack_setup' ) ) {
// Add theme support for Responsive Videos.
add_theme_support( 'jetpack-responsive-videos' );
- // Add theme support for Social Menus
+ // Add theme support for Social Menus.
add_theme_support( 'jetpack-social-menu' );
}
}
-
-/**
- * Custom render function for Infinite Scroll.
- */
-
if ( ! function_exists( 'understrap_components_infinite_scroll_render' ) ) {
+ /**
+ * Custom render function for Infinite Scroll.
+ */
function understrap_components_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
@@ -59,8 +57,13 @@ if ( ! function_exists( 'understrap_components_infinite_scroll_render' ) ) {
}
if ( ! function_exists( 'understrap_components_social_menu' ) ) {
+ /**
+ * Display Jetpack's social menu if available.
+ * Avoids fatal errors if Jetpack isn’t activated.
+ */
function understrap_components_social_menu() {
if ( ! function_exists( 'jetpack_social_menu' ) ) {
+ // Return early if social menu is not available.
return;
} else {
jetpack_social_menu();
diff --git a/inc/pagination.php b/inc/pagination.php
index 1bfbcbb..7f5f212 100644
--- a/inc/pagination.php
+++ b/inc/pagination.php
@@ -77,7 +77,7 @@ if ( ! function_exists( 'understrap_pagination' ) ) {
foreach ( $links as $key => $link ) {
?>
-
+
__( 'Primary Menu', 'understrap' ),
- ) );
+ register_nav_menus(
+ array(
+ 'primary' => __( 'Primary Menu', 'understrap' ),
+ )
+ );
/*
* 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',
- ) );
+ add_theme_support(
+ 'html5',
+ array(
+ 'search-form',
+ 'comment-form',
+ 'comment-list',
+ 'gallery',
+ 'caption',
+ )
+ );
/*
* Adding Thumbnail basic support
@@ -74,19 +79,28 @@ if ( ! function_exists( 'understrap_setup' ) ) {
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
- add_theme_support( 'post-formats', array(
- 'aside',
- 'image',
- 'video',
- 'quote',
- 'link',
- ) );
+ add_theme_support(
+ 'post-formats',
+ array(
+ 'aside',
+ 'image',
+ 'video',
+ 'quote',
+ 'link',
+ )
+ );
// Set up the WordPress core custom background feature.
- add_theme_support( 'custom-background', apply_filters( 'understrap_custom_background_args', array(
- 'default-color' => 'ffffff',
- 'default-image' => '',
- ) ) );
+ add_theme_support(
+ 'custom-background',
+ apply_filters(
+ 'understrap_custom_background_args',
+ array(
+ 'default-color' => 'ffffff',
+ 'default-image' => '',
+ )
+ )
+ );
// Set up the WordPress Theme logo feature.
add_theme_support( 'custom-logo' );
@@ -131,8 +145,10 @@ if ( ! function_exists( 'understrap_all_excerpts_get_more_link' ) ) {
*/
function understrap_all_excerpts_get_more_link( $post_excerpt ) {
if ( ! is_admin() ) {
- $post_excerpt = $post_excerpt . ' [...]' . __( 'Read More...',
- 'understrap' ) . '
';
+ $post_excerpt = $post_excerpt . ' [...]' . __(
+ 'Read More...',
+ 'understrap'
+ ) . '
';
}
return $post_excerpt;
}
diff --git a/inc/template-tags.php b/inc/template-tags.php
index e8bba11..ef8a4ae 100644
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -10,23 +10,25 @@
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
-/**
- * Prints HTML with meta information for the current post-date/time and author.
- */
if ( ! function_exists( 'understrap_posted_on' ) ) {
+ /**
+ * Prints HTML with meta information for the current post-date/time and author.
+ */
function understrap_posted_on() {
$time_string = '%2$s ';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '%2$s (%4$s) ';
}
- $time_string = sprintf( $time_string,
+ $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 = apply_filters(
- 'understrap_posted_on', sprintf(
+ 'understrap_posted_on',
+ sprintf(
'%1$s %3$s ',
esc_html_x( 'Posted on', 'post date', 'understrap' ),
esc_url( get_permalink() ),
@@ -34,21 +36,22 @@ if ( ! function_exists( 'understrap_posted_on' ) ) {
)
);
$byline = apply_filters(
- 'understrap_posted_by', sprintf(
+ 'understrap_posted_by',
+ sprintf(
' %1$s %3$s ',
$posted_on ? esc_html_x( 'by', 'post author', 'understrap' ) : esc_html_x( 'Posted by', 'post author', 'understrap' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
)
);
- echo $posted_on . $byline; // WPCS: XSS OK.
+ echo $posted_on . $byline; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
-/**
- * Prints HTML with meta information for the categories, tags and comments.
- */
if ( ! function_exists( 'understrap_entry_footer' ) ) {
+ /**
+ * Prints HTML with meta information for the categories, tags and comments.
+ */
function understrap_entry_footer() {
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
@@ -56,13 +59,13 @@ if ( ! function_exists( 'understrap_entry_footer' ) ) {
$categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) );
if ( $categories_list && understrap_categorized_blog() ) {
/* translators: %s: Categories of current post */
- printf( '' . esc_html__( 'Posted in %s', 'understrap' ) . ' ', $categories_list ); // WPCS: XSS OK.
+ printf( '' . esc_html__( 'Posted in %s', 'understrap' ) . ' ', $categories_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) );
if ( $tags_list ) {
/* translators: %s: Tags of current post */
- printf( '' . esc_html__( 'Tagged %s', 'understrap' ) . ' ', $tags_list ); // WPCS: XSS OK.
+ printf( '' . esc_html__( 'Tagged %s', 'understrap' ) . ' ', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
@@ -82,21 +85,24 @@ if ( ! function_exists( 'understrap_entry_footer' ) ) {
}
}
-/**
- * Returns true if a blog has more than 1 category.
- *
- * @return bool
- */
if ( ! function_exists( 'understrap_categorized_blog' ) ) {
+ /**
+ * Returns true if a blog has more than 1 category.
+ *
+ * @return bool
+ */
function understrap_categorized_blog() {
- if ( false === ( $all_the_cool_cats = get_transient( 'understrap_categories' ) ) ) {
+ $all_the_cool_cats = get_transient( 'understrap_categories' );
+ if ( false === $all_the_cool_cats ) {
// Create an array of all the categories that are attached to posts.
- $all_the_cool_cats = get_categories( array(
- 'fields' => 'ids',
- 'hide_empty' => 1,
- // We only need to know if there is more than one category.
- 'number' => 2,
- ) );
+ $all_the_cool_cats = get_categories(
+ array(
+ 'fields' => 'ids',
+ 'hide_empty' => 1,
+ // We only need to know if there is more than one category.
+ 'number' => 2,
+ )
+ );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'understrap_categories', $all_the_cool_cats );
@@ -111,13 +117,13 @@ if ( ! function_exists( 'understrap_categorized_blog' ) ) {
}
}
-/**
- * Flush out the transients used in understrap_categorized_blog.
- */
add_action( 'edit_category', 'understrap_category_transient_flusher' );
-add_action( 'save_post', 'understrap_category_transient_flusher' );
+add_action( 'save_post', 'understrap_category_transient_flusher' );
if ( ! function_exists( 'understrap_category_transient_flusher' ) ) {
+ /**
+ * Flush out the transients used in understrap_categorized_blog.
+ */
function understrap_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
diff --git a/inc/widgets.php b/inc/widgets.php
index b386a2a..f8a6842 100644
--- a/inc/widgets.php
+++ b/inc/widgets.php
@@ -17,6 +17,7 @@ defined( 'ABSPATH' ) || exit;
add_filter( 'dynamic_sidebar_params', 'understrap_widget_classes' );
if ( ! function_exists( 'understrap_widget_classes' ) ) {
+
/**
* Count number of visible widgets in a sidebar and add classes to widgets accordingly,
* so widgets can be displayed one, two, three or four per row.
@@ -24,6 +25,8 @@ if ( ! function_exists( 'understrap_widget_classes' ) ) {
* @global array $sidebars_widgets
*
* @param array $params {
+ * Parameters passed to a widget’s display callback.
+ *
* @type array $args {
* An array of widget display arguments.
*
@@ -86,7 +89,7 @@ if ( ! function_exists( 'understrap_widget_classes' ) ) {
return $params;
}
-} // endif function_exists( 'understrap_widget_classes' ).
+} // End of if function_exists( 'understrap_widget_classes' ).
add_action( 'widgets_init', 'understrap_widgets_init' );
@@ -168,4 +171,4 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) {
);
}
-} // endif function_exists( 'understrap_widgets_init' ).
+} // End of function_exists( 'understrap_widgets_init' ).
diff --git a/inc/woocommerce.php b/inc/woocommerce.php
index fe284d2..40c451b 100644
--- a/inc/woocommerce.php
+++ b/inc/woocommerce.php
@@ -26,18 +26,18 @@ if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
}
}
-/**
- * First unhook the WooCommerce wrappers
- */
+// First unhook the WooCommerce content wrappers.
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
-/**
- * Then hook in your own functions to display the wrappers your theme requires
- */
+// Then hook in your own functions to display the wrappers your theme requires.
add_action( 'woocommerce_before_main_content', 'understrap_woocommerce_wrapper_start', 10 );
add_action( 'woocommerce_after_main_content', 'understrap_woocommerce_wrapper_end', 10 );
+
if ( ! function_exists( 'understrap_woocommerce_wrapper_start' ) ) {
+ /**
+ * Display the theme specific start of the page wrapper.
+ */
function understrap_woocommerce_wrapper_start() {
$container = get_theme_mod( 'understrap_container_type' );
echo '';
@@ -47,7 +47,11 @@ if ( ! function_exists( 'understrap_woocommerce_wrapper_start' ) ) {
echo '';
}
}
+
if ( ! function_exists( 'understrap_woocommerce_wrapper_end' ) ) {
+ /**
+ * Display the theme specific end of the page wrapper.
+ */
function understrap_woocommerce_wrapper_end() {
echo ' ';
get_template_part( 'global-templates/right-sidebar-check' );
@@ -57,18 +61,17 @@ if ( ! function_exists( 'understrap_woocommerce_wrapper_end' ) ) {
}
}
-
-/**
- * Filter hook function monkey patching form classes
- * Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826
- *
- * @param string $args Form attributes.
- * @param string $key Not in use.
- * @param null $value Not in use.
- *
- * @return mixed
- */
if ( ! function_exists( 'understrap_wc_form_field_args' ) ) {
+ /**
+ * Filter hook function monkey patching form classes
+ * Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826
+ *
+ * @param string $args Form attributes.
+ * @param string $key Not in use.
+ * @param null $value Not in use.
+ *
+ * @return mixed
+ */
function understrap_wc_form_field_args( $args, $key, $value = null ) {
// Start field type switch case.
switch ( $args['type'] ) {
@@ -133,7 +136,7 @@ if ( ! function_exists( 'understrap_wc_form_field_args' ) ) {
$args['input_class'] = array( 'form-control', 'input-lg' );
$args['label_class'] = array( 'control-label' );
break;
- } // end switch ($args).
+ } // End of switch ( $args ).
return $args;
}
}
diff --git a/inc/wpcom.php b/inc/wpcom.php
index 4f40f01..7a30ecb 100644
--- a/inc/wpcom.php
+++ b/inc/wpcom.php
@@ -10,14 +10,14 @@
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
-/**
- * Adds support for wp.com-specific theme functions.
- *
- * @global array $themecolors
- */
add_action( 'after_setup_theme', 'understrap_wpcom_setup' );
if ( ! function_exists( 'understrap_wpcom_setup' ) ) {
+ /**
+ * Adds support for wp.com-specific theme functions.
+ *
+ * @global array $themecolors
+ */
function understrap_wpcom_setup() {
global $themecolors;
@@ -37,13 +37,12 @@ if ( ! function_exists( 'understrap_wpcom_setup' ) ) {
}
}
-
-/*
- * WordPress.com-specific styles
- */
add_action( 'wp_enqueue_scripts', 'understrap_wpcom_styles' );
if ( ! function_exists( 'understrap_wpcom_styles' ) ) {
+ /**
+ * WordPress.com-specific styles
+ */
function understrap_wpcom_styles() {
wp_enqueue_style( 'understrap-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', array(), '20160411' );
}
diff --git a/index.php b/index.php
index f10d4c7..6de21f7 100644
--- a/index.php
+++ b/index.php
@@ -34,13 +34,11 @@ $container = get_theme_mod( 'understrap_container_type' );
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ }
+ } else {
+ get_template_part( 'loop-templates/content', 'none' );
+ }
+ ?>
@@ -72,4 +66,5 @@ $container = get_theme_mod( 'understrap_container_type' );
-
+ if ( is_home() && current_user_can( 'publish_posts' ) ) :
- Get started here.', 'understrap' ), array(
- 'a' => array(
- 'href' => array(),
- ),
-) ), esc_url( admin_url( 'post-new.php' ) ) ); ?>
+ $kses = array( 'a' => array( 'href' => array() ) );
+ printf(
+ /* translators: 1: Link to WP admin new post page. */
+ '' . wp_kses( __( 'Ready to publish your first post? Get started here .', 'understrap' ), $kses ) . '
',
+ esc_url( admin_url( 'post-new.php' ) )
+ );
-
+ elseif ( is_search() ) :
-
-
+ printf(
+ '%s
',
+ esc_html__( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'understrap' )
+ );
+ get_search_form();
-
-
+ else :
+
+ printf(
+ '%s
',
+ esc_html__( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'understrap' )
+ );
+ get_search_form();
+
+ endif;
+ ?>
diff --git a/loop-templates/content-search.php b/loop-templates/content-search.php
index 48d25b9..71cf4af 100644
--- a/loop-templates/content-search.php
+++ b/loop-templates/content-search.php
@@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit;
);
?>
-
+
diff --git a/loop-templates/content.php b/loop-templates/content.php
index 1bc0864..29bdc53 100644
--- a/loop-templates/content.php
+++ b/loop-templates/content.php
@@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit;
);
?>
-
+
diff --git a/page-templates/blank.php b/page-templates/blank.php
index cb58a77..329305e 100644
--- a/page-templates/blank.php
+++ b/page-templates/blank.php
@@ -20,11 +20,12 @@ defined( 'ABSPATH' ) || exit;
-
-
-
-
-
-
+