diff --git a/404.php b/404.php index ccb6c6df8..d2ce1010e 100644 --- a/404.php +++ b/404.php @@ -4,7 +4,7 @@ * * @link https://codex.wordpress.org/Creating_an_Error_404_Page * - * @package _s + * @package wd_s */ get_header(); ?> @@ -13,12 +13,12 @@
-

+

diff --git a/README.md b/README.md index 65a19790c..45ec00938 100644 --- a/README.md +++ b/README.md @@ -53,15 +53,20 @@ If you want to set me up manually: 2. Find & Replace -You'll need to change all instances of the names: `_s`. - -- Search for: `'_s'` and replace with: `'project-name'` (inside single quotations) to capture the text domain -- Search for: `"_s"` and replace with: `"project-name"` (inside double quotations) to capture the text domain -- Search for: `_s_` and replace with: `project-name_` to capture all the function names -- Search for: `Text Domain: _s` and replace with: `Text Domain: project-name` in style.css -- Search for (and include the leading space): ` _s` and replace with: ` Project Name` (with a space before it) to capture DocBlocks -- Search for: `_s-` and replace with: `project-name-` to capture prefixed handles -- Search for `_s.pot` and replace with: `project-name.pot` to capture translation files +You'll need to change all instances of the name: `wd_s`. + +- Search for: `@package wd_s` and replace with: `@package project_name` to capture the package name +- Update `"WebDevStudios\wd_s,wd_s"` to: `"CompanyName\project_name,project_name"` (with double quotes) in phpcs.xml.dist +- Search for: `WebDevStudios\wd_s` and replace with: `CompanyName\project_name` to capture the namespaces +- Update `"webdevstudios/wd_s"` to `"companyname/project_name"` (with double quotes) in composer.json +- Search for: `, 'wd_s'` and replace with: `, 'project_name'` (inside backticks) to capture the text domain +- Update `Text Domain: wd_s` to: `Text Domain: project_name` in style.css +- Update `"wd_s"` to: `"project_name"` (with double quotes) in phpcs.xml.dist and package.json +- Update `'wd_s'` to: `'project_name'` (with single quotes) in inc/setup/setup.php +- Search for: `wd_s_` and replace with: `project_name_` to capture all the function names +- Search for: `'wd_s-` and replace with: `'project_name-` to capture prefixed handles +- Search for `wd_s.pot` and replace with: `project_name.pot` to capture translation files +- Search for `wdunderscores.test` and replace with: `project_name.test` to match your local development URL - Edit the theme information in the header of style.scss to meet your needs ## Setup diff --git a/archive.php b/archive.php index 53148b597..27b4fee07 100644 --- a/archive.php +++ b/archive.php @@ -4,43 +4,46 @@ * * @link https://codex.wordpress.org/Template_Hierarchy * - * @package _s + * @package wd_s */ +use function WebDevStudios\wd_s\print_numeric_pagination; + get_header(); ?> -
+
- + - + ?> + - -
+
- + diff --git a/comments.php b/comments.php index 4b1acfb80..6f28b937b 100644 --- a/comments.php +++ b/comments.php @@ -7,7 +7,7 @@ * * @link https://codex.wordpress.org/Template_Hierarchy * - * @package _s + * @package wd_s */ /** @@ -15,13 +15,14 @@ * the visitor has not yet entered the password we will * return early without loading the comments. */ + if ( post_password_required() ) { return; } ?>
-

+

' . wp_kses_post( get_the_title() ) . '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- XSS OK. ); @@ -42,11 +43,11 @@ if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> @@ -68,11 +69,11 @@ if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> @@ -84,7 +85,7 @@ // 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' ) ) : ?> -

+

-
- + diff --git a/functions.php b/functions.php index 676995593..c91bed1dc 100644 --- a/functions.php +++ b/functions.php @@ -4,28 +4,40 @@ * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * - * @package _s + * @package wd_s */ +namespace WebDevStudios\wd_s; + /** * Get all the include files for the theme. * * @author WebDevStudios */ -function _s_get_theme_include_files() { - return [ - 'inc/setup.php', // Theme set up. Should be included first. - 'inc/compat.php', // Backwards Compatibility. +function include_inc_files() { + $files = [ 'inc/customizer/customizer.php', // Customizer additions. - 'inc/extras.php', // Custom functions that act independently of the theme templates. - 'inc/hooks.php', // Load custom filters and hooks. - 'inc/security.php', // WordPress hardening. - 'inc/scaffolding.php', // Scaffolding. - 'inc/scripts.php', // Load styles and scripts. - 'inc/template-tags.php', // Custom template tags for this theme. + 'inc/functions/', // Custom functions that act independently of the theme templates. + 'inc/hooks/', // Load custom filters and hooks. + 'inc/post-types/', // Load custom post types. + 'inc/scaffolding/', // Scaffolding. + 'inc/setup/', // Theme setup. + 'inc/shortcodes/', // Load shortcodes. + 'inc/template-tags/', // Custom template tags for this theme. ]; -} -foreach ( _s_get_theme_include_files() as $include ) { - require trailingslashit( get_template_directory() ) . $include; + foreach ( $files as $include ) { + $include = trailingslashit( get_template_directory() ) . $include; + + // Allows inclusion of individual files or all .php files in a directory. + if ( is_dir( $include ) ) { + foreach ( glob( $include . '*.php' ) as $file ) { + require $file; + } + } else { + require $include; + } + } } + +include_inc_files(); diff --git a/header.php b/header.php index 4cd2804d0..5f4887346 100644 --- a/header.php +++ b/header.php @@ -6,7 +6,7 @@ * * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * - * @package _s + * @package wd_s */ ?> @@ -28,7 +28,7 @@ - +
- +
-