Skip to content

Commit

Permalink
Refactor, add namespacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Niq1982 committed Feb 10, 2020
1 parent b98b472 commit 700b495
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 8 deletions.
2 changes: 2 additions & 0 deletions 404.php
Expand Up @@ -9,6 +9,8 @@
* @link https://codex.wordpress.org/Creating_an_Error_404_Page
*/

namespace Air_Light;

get_header();

get_template_part( 'template-parts/hero', get_post_type() ); ?>
Expand Down
2 changes: 2 additions & 0 deletions archive.php
Expand Up @@ -9,6 +9,8 @@
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*/

namespace Air_Light;

get_header();

get_template_part( 'template-parts/hero', get_post_type() ); ?>
Expand Down
2 changes: 2 additions & 0 deletions footer.php
Expand Up @@ -11,6 +11,8 @@
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*/

namespace Air_Light;

?>

</div><!-- #content -->
Expand Down
3 changes: 3 additions & 0 deletions inc/nav-walker.php
Expand Up @@ -16,6 +16,9 @@
*
* @package air-light
*/

namespace Air_Light;

class Air_Light_Navwalker extends Walker_Nav_Menu {

public function start_lvl( &$output, $depth = 0, $args = array() ) {
Expand Down
3 changes: 3 additions & 0 deletions inc/theme-setup.php
Expand Up @@ -22,6 +22,9 @@

'default_featured_image' => get_theme_file_uri( 'images/default.jpg' ),

'logo_path' => get_theme_file_path( '/svg/logo.svg' ),
'logo_url' => get_theme_file_uri( '/svg/logo.svg' ),

// Set theme support
'theme_support' => [
'automatic-feed-links',
Expand Down
2 changes: 2 additions & 0 deletions sidebar.php
Expand Up @@ -10,6 +10,8 @@
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*/

namespace Air_Light;

if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
} ?>
Expand Down
12 changes: 7 additions & 5 deletions single.php
Expand Up @@ -10,6 +10,8 @@
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*/

namespace Air_Light;

the_post();

get_header();
Expand All @@ -29,11 +31,11 @@
/* translators: %s: Name of current post. Only visible to screen readers */
wp_kses(
__( 'Edit <span class="screen-reader-text">%s</span>', 'air-light' ),
array(
'span' => array(
'class' => array(),
),
)
[
'span' => [
'class' => [],
],
]
),
get_the_title()
),
Expand Down
4 changes: 2 additions & 2 deletions template-parts/header/branding.php
Expand Up @@ -16,7 +16,7 @@
<h1 class="site-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<span class="screen-reader-text"><?php bloginfo( 'name' ); ?></span>
<?php include get_theme_file_path( '/svg/logo.svg' ); ?>
<?php include THEME_SETTINGS['logo_path']; ?>
</a>
</h1>

Expand All @@ -25,7 +25,7 @@
<p class="site-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<span class="screen-reader-text"><?php bloginfo( 'name' ); ?></span>
<?php include get_theme_file_path( '/svg/logo.svg' ); ?>
<?php include THEME_SETTINGS['logo_path']; ?>
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion template-parts/header/navigation.php
Expand Up @@ -27,7 +27,7 @@
'menu_class' => 'menu-items',
'menu_id' => 'main-menu',
'echo' => true,
'fallback_cb' => 'Air_Light_Navwalker::fallback',
'fallback_cb' => __NAMESPACE__ . '\Air_Light_Navwalker::fallback',
'items_wrap' => '<ul class="%2$s">%3$s</ul>',
'walker' => new Air_Light_Navwalker(),
) ); ?>
Expand Down

0 comments on commit 700b495

Please sign in to comment.