@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function afterSetupTheme() |
| 18 | 18 | { |
| 19 | - add_editor_style( Theme::assetUri( 'css/editor.css' )); |
|
| 20 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
| 21 | - add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] ); |
|
| 22 | - add_theme_support( 'post-thumbnails' ); |
|
| 23 | - add_theme_support( 'soil-clean-up' ); |
|
| 24 | - add_theme_support( 'soil-jquery-cdn' ); |
|
| 25 | - add_theme_support( 'soil-nav-walker' ); |
|
| 26 | - add_theme_support( 'soil-nice-search' ); |
|
| 27 | - add_theme_support( 'soil-relative-urls' ); |
|
| 28 | - add_theme_support( 'title-tag' ); |
|
| 29 | - load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' ); |
|
| 30 | - |
|
| 31 | - $menus = apply_filters( 'castor/register/nav_menus', [ |
|
| 32 | - 'main_menu' => __( 'Main Menu', 'castor' ), |
|
| 19 | + add_editor_style(Theme::assetUri('css/editor.css')); |
|
| 20 | + add_theme_support('customize-selective-refresh-widgets'); |
|
| 21 | + add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); |
|
| 22 | + add_theme_support('post-thumbnails'); |
|
| 23 | + add_theme_support('soil-clean-up'); |
|
| 24 | + add_theme_support('soil-jquery-cdn'); |
|
| 25 | + add_theme_support('soil-nav-walker'); |
|
| 26 | + add_theme_support('soil-nice-search'); |
|
| 27 | + add_theme_support('soil-relative-urls'); |
|
| 28 | + add_theme_support('title-tag'); |
|
| 29 | + load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages'); |
|
| 30 | + |
|
| 31 | + $menus = apply_filters('castor/register/nav_menus', [ |
|
| 32 | + 'main_menu' => __('Main Menu', 'castor'), |
|
| 33 | 33 | ]); |
| 34 | 34 | |
| 35 | - foreach( $menus as $location => $description ) { |
|
| 36 | - register_nav_menu( $location, $description ); |
|
| 35 | + foreach ($menus as $location => $description) { |
|
| 36 | + register_nav_menu($location, $description); |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function filterLoginTitle() |
| 45 | 45 | { |
| 46 | - return get_bloginfo( 'name' ); |
|
| 46 | + return get_bloginfo('name'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -52,18 +52,18 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function filterLoginUrl() |
| 54 | 54 | { |
| 55 | - return get_bloginfo( 'url' ); |
|
| 55 | + return get_bloginfo('url'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @return string |
| 60 | 60 | * @filter template_include |
| 61 | 61 | */ |
| 62 | - public function filterTemplate( $template ) |
|
| 62 | + public function filterTemplate($template) |
|
| 63 | 63 | { |
| 64 | - if( is_string( $template )) { |
|
| 65 | - $template = Template::setLayout( $template ); |
|
| 66 | - Development::storeTemplatePath( $template ); |
|
| 64 | + if (is_string($template)) { |
|
| 65 | + $template = Template::setLayout($template); |
|
| 66 | + Development::storeTemplatePath($template); |
|
| 67 | 67 | } |
| 68 | 68 | return $template; |
| 69 | 69 | } |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | * @return array |
| 73 | 73 | * @filter {$type}_template_hierarchy |
| 74 | 74 | */ |
| 75 | - public function filterTemplateHierarchy( array $templates ) |
|
| 75 | + public function filterTemplateHierarchy(array $templates) |
|
| 76 | 76 | { |
| 77 | - return array_map( function( $template ) { |
|
| 78 | - return Utility::startWith( 'templates/', $template ); |
|
| 79 | - }, $templates ); |
|
| 77 | + return array_map(function($template) { |
|
| 78 | + return Utility::startWith('templates/', $template); |
|
| 79 | + }, $templates); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function login() |
| 87 | 87 | { |
| 88 | - if( file_exists( Theme::assetPath( 'css/login.css' ))) { |
|
| 89 | - printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' )); |
|
| 88 | + if (file_exists(Theme::assetPath('css/login.css'))) { |
|
| 89 | + printf('<link rel="stylesheet" href="%s">', Theme::assetUri('css/login.css')); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function registerAssets() |
| 98 | 98 | { |
| 99 | - wp_enqueue_style( 'castor/main.css', |
|
| 100 | - Theme::assetUri( 'css/main.css' ), |
|
| 101 | - apply_filters( 'castor/enqueue/css/deps', [] ), |
|
| 99 | + wp_enqueue_style('castor/main.css', |
|
| 100 | + Theme::assetUri('css/main.css'), |
|
| 101 | + apply_filters('castor/enqueue/css/deps', []), |
|
| 102 | 102 | null |
| 103 | 103 | ); |
| 104 | - wp_enqueue_script( 'castor/main.js', |
|
| 105 | - Theme::assetUri( 'js/main.js' ), |
|
| 106 | - apply_filters( 'castor/enqueue/js/deps', [] ), |
|
| 104 | + wp_enqueue_script('castor/main.js', |
|
| 105 | + Theme::assetUri('js/main.js'), |
|
| 106 | + apply_filters('castor/enqueue/js/deps', []), |
|
| 107 | 107 | null, |
| 108 | 108 | true |
| 109 | 109 | ); |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @return void |
| 114 | 114 | * @action customize_register |
| 115 | 115 | */ |
| 116 | - public function registerCustomizer( WP_Customize_Manager $manager ) |
|
| 116 | + public function registerCustomizer(WP_Customize_Manager $manager) |
|
| 117 | 117 | { |
| 118 | - $manager->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 119 | - $manager->selective_refresh->add_partial( 'blogname', [ |
|
| 118 | + $manager->get_setting('blogname')->transport = 'postMessage'; |
|
| 119 | + $manager->selective_refresh->add_partial('blogname', [ |
|
| 120 | 120 | 'selector' => '.brand', |
| 121 | 121 | 'render_callback' => function() { |
| 122 | - bloginfo( 'name' ); |
|
| 122 | + bloginfo('name'); |
|
| 123 | 123 | }, |
| 124 | 124 | ]); |
| 125 | 125 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function registerCustomizerAssets() |
| 132 | 132 | { |
| 133 | - wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true ); |
|
| 133 | + wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -139,23 +139,23 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function registerSidebars() |
| 141 | 141 | { |
| 142 | - $defaults = apply_filters( 'castor/register/sidebars/defaults', [ |
|
| 142 | + $defaults = apply_filters('castor/register/sidebars/defaults', [ |
|
| 143 | 143 | 'before_widget' => '<div class="widget %1$s %2$s">', |
| 144 | 144 | 'after_widget' => '</div>', |
| 145 | 145 | 'before_title' => '<h4>', |
| 146 | 146 | 'after_title' => '</h4>', |
| 147 | 147 | ]); |
| 148 | 148 | |
| 149 | - $sidebars = apply_filters( 'castor/register/sidebars', [ |
|
| 150 | - 'sidebar-primary' => __( 'Primary Sidebar', 'castor' ), |
|
| 151 | - 'sidebar-footer' => __( 'Footer Sidebar', 'castor' ), |
|
| 149 | + $sidebars = apply_filters('castor/register/sidebars', [ |
|
| 150 | + 'sidebar-primary' => __('Primary Sidebar', 'castor'), |
|
| 151 | + 'sidebar-footer' => __('Footer Sidebar', 'castor'), |
|
| 152 | 152 | ]); |
| 153 | 153 | |
| 154 | - foreach( $sidebars as $id => $name ) { |
|
| 154 | + foreach ($sidebars as $id => $name) { |
|
| 155 | 155 | register_sidebar([ |
| 156 | 156 | 'id' => $id, |
| 157 | 157 | 'name' => $name, |
| 158 | - ] + $defaults ); |
|
| 158 | + ] + $defaults); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |