Skip to content
Permalink
Browse files

More cleanup for easy testing later

  • Loading branch information
ChrisWiegman committed Aug 20, 2020
1 parent 8aa7ba3 commit 6ca778a71d540f56a0aab5ed07f4b9e2a281c35d
Showing with 34 additions and 13 deletions.
  1. +1 −1 tests/{test-plugin-file.php → test-functions-file.php}
  2. +33 −12 theme/functions.php
@@ -19,7 +19,7 @@ class PluginFileTest extends \WP_Mock\Tools\TestCase {
*/
public function test_chriswiegman_wordpress_plugin_starter_loader() {

this->assertEquals( 1, 1 );
$this->assertEquals( 1, 1 );

}
}
@@ -5,17 +5,45 @@
* @package chriswiegman-theme
*/

namespace CW\Theme;

// Useful global constants.
define( 'CW_THEME_VERSION', '9.0.0' );

/**
* Setup theme hooks.
*
* @since 9.0.0
*
* @return void
*/
function init() {

$n = function ( $function ) {
return __NAMESPACE__ . "\\$function";
};

// Add new actions and filters.
add_action( 'after_setup_theme', $n( 'action_after_setup_theme' ) );
add_action( 'widgets_init', $n( 'action_widgets_init' ) );
add_action( 'wp_enqueue_scripts', $n( 'action_wp_enqueue_scripts' ) );

// Cleanup extra garbage.
if ( function_exists( 'remove_action' ) ) {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
}

}

/**
* Action after_theme_setup
*
* Sets up theme defaults and registers support for various WordPress features.
*
* @since 5.0.0
* @since 9.0.0
*/
function cw_theme_action_after_setup_theme() {
function action_after_setup_theme() {

// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
@@ -40,16 +68,14 @@ function cw_theme_action_after_setup_theme() {

}

add_action( 'after_setup_theme', 'cw_theme_action_after_setup_theme' );

/**
* Action widgets_init
*
* Register widget area.
*
* @since 9.0.0
*/
function cw_theme_action_widgets_init() {
function action_widgets_init() {

register_sidebar(
array(
@@ -65,7 +91,6 @@ function cw_theme_action_widgets_init() {

}

add_action( 'widgets_init', 'cw_theme_action_widgets_init' );

/**
* Action wp_enqueue_scripts
@@ -74,7 +99,7 @@ function cw_theme_action_widgets_init() {
*
* @since 9.0.0
*/
function cw_theme_action_wp_enqueue_scripts() {
function action_wp_enqueue_scripts() {

$min = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min';

@@ -84,8 +109,4 @@ function cw_theme_action_wp_enqueue_scripts() {

}

add_action( 'wp_enqueue_scripts', 'cw_theme_action_wp_enqueue_scripts' );

// Cleanup extra garbage.
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
init();

0 comments on commit 6ca778a

Please sign in to comment.
You can’t perform that action at this time.