Skip to content

Commit

Permalink
Merge pull request #1062 from WebDevStudios/feature/WDSUS-43-Folder-r…
Browse files Browse the repository at this point in the history
…estructure

Feature/WDSUS-43 Folder Restructure
  • Loading branch information
khleomix authored Sep 6, 2023
2 parents 3bb5239 + bd1dd85 commit 2645b23
Show file tree
Hide file tree
Showing 67 changed files with 99 additions and 162 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Install theme dependencies and trigger an initial build.
>Note: You will need to have Composer 2 and NPM 9 installed first.
```bash
npm i
npm i && composer i
```

### Development
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 19 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
* @package wd_s
*/

use function WebDevStudios\wd_s\print_copyright_text;
?>

<footer class="site-footer">

<div class="site-info">
<?php the_custom_logo(); ?>
<p><?php echo esc_html__( ' Copyright &copy; ', 'wd_s' ) . esc_attr( gmdate( 'Y' ) ); ?></p>
<?php
if ( get_theme_mod( 'wd_s_copyright_text' ) ) :
print_copyright_text();
else :
the_custom_logo();
echo '<p>' . esc_html__( ' Copyright &copy; ', 'wd_s' ) . esc_attr( gmdate( 'Y' ) ) . '</p>';
endif;
?>
</div><!-- .site-info -->

</footer><!-- .site-footer-->
Expand Down
7 changes: 0 additions & 7 deletions inc/customizer/assets/scripts/livepreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@
} );
} );

// Background image.
api( 'background_image', function ( value ) {
value.bind( function ( to ) {
$( 'body' ).toggleClass( 'custom-background-image', '' !== to );
} );
} );

// Copyright text.
api( 'wd_s_copyright_text', function ( value ) {
value.bind( function ( to ) {
Expand Down
1 change: 0 additions & 1 deletion inc/customizer/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function live_preview_support( $wp_customize ) {
'blogname',
'blogdescription',
'header_textcolor',
'background_image',
'wd_s_copyright_text',
];

Expand Down
21 changes: 0 additions & 21 deletions inc/customizer/sections.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,6 @@ function customize_sections( $wp_customize ) {
]
);

// Register a social links section.
$wp_customize->add_section(
'wd_s_social_links_section',
[
'title' => esc_html__( 'Social Media', 'wd_s' ),
'description' => esc_html__( 'Links here power the print_social_network_links() template tag.', 'wd_s' ),
'priority' => 90,
'panel' => 'site-options',
]
);

// Register a header section.
$wp_customize->add_section(
'wd_s_header_section',
[
'title' => esc_html__( 'Header Customizations', 'wd_s' ),
'priority' => 90,
'panel' => 'site-options',
]
);

// Register a footer section.
$wp_customize->add_section(
'wd_s_footer_section',
Expand Down
41 changes: 0 additions & 41 deletions inc/customizer/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,47 +58,6 @@ function customize_additional_scripts( $wp_customize ) {

add_action( 'customize_register', __NAMESPACE__ . '\customize_additional_scripts' );

/**
* Register a social icons setting.
*
* @author WebDevStudios
*
* @param WP_Customize_Manager $wp_customize Instance of WP_Customize_Manager.
*/
function customize_social_icons( $wp_customize ) {
// Create an array of our social links for ease of setup.
$social_networks = [
'facebook',
'instagram',
'twitter',
'linkedin',
];

// Loop through our networks to setup our fields.
foreach ( $social_networks as $network ) {

// Register a setting.
$wp_customize->add_setting(
'wd_s_' . $network . '_link',
[
'default' => '',
'sanitize_callback' => 'esc_url',
]
);

// Create the setting field.
$wp_customize->add_control(
'wd_s_' . $network . '_link',
[
'label' => /* translators: the social network name. */ sprintf( esc_attr__( '%s URL', 'wd_s' ), ucwords( $network ) ),
'section' => 'wd_s_social_links_section',
'type' => 'text',
]
);
}
}

add_action( 'customize_register', __NAMESPACE__ . '\customize_social_icons' );

/**
* Register copyright text setting.
Expand Down
2 changes: 1 addition & 1 deletion inc/setup/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function scripts() {

// Register styles & scripts.
wp_enqueue_style( 'wd_s-styles', get_stylesheet_directory_uri() . '/build/index.css', [], $asset_file['version'] );
wp_enqueue_style( 'custom-preflight', get_stylesheet_directory_uri() . '/src/tailwind-preflight.css', [], $asset_file['version'] );
wp_enqueue_style( 'custom-preflight', get_stylesheet_directory_uri() . '/assets/tailwind-preflight.css', [], $asset_file['version'] );
wp_enqueue_script( 'wd_s-scripts', get_stylesheet_directory_uri() . '/build/index.js', $asset_file['dependencies'], $asset_file['version'], true );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
Expand Down
22 changes: 22 additions & 0 deletions inc/template-tags/print-copyright-text.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Echo the copyright text saved in the Customizer.
*
* @package wd_s
*/

namespace WebDevStudios\wd_s;

/**
* Echo the copyright text saved in the Customizer.
*
* @author WebDevStudios
*/
function print_copyright_text() {
// Grab our customizer settings.
$copyright_text = get_theme_mod( 'wd_s_copyright_text' );

if ( $copyright_text ) {
echo get_post_content( do_shortcode( $copyright_text ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- XSS OK.
}
}
51 changes: 0 additions & 51 deletions inc/template-tags/print-mobile-menu.php

This file was deleted.

8 changes: 4 additions & 4 deletions inc/wpcli/class-blocks-scaffold.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ private function create_block_editor_assets() {
}

// copy styles.
if ( ! $this->init_filesystem()->copy( $asset_scss, ROOT_PATH . 'src/scss/blocks/custom/' . $this->name . '.editor.scss' ) ) {
if ( ! $this->init_filesystem()->copy( $asset_scss, ROOT_PATH . 'assets/scss/blocks/custom/' . $this->name . '.editor.scss' ) ) {
WP_CLI::error( 'ERROR :: Could not create styles file.', true );
}

// add js file for build process.
if (
! $this->init_filesystem()->put_contents(
ROOT_PATH . 'src/js/blocks/custom/' . $this->name . '.editor.js',
ROOT_PATH . 'assets/js/blocks/custom/' . $this->name . '.editor.js',
"import '../../../scss/blocks/custom/" . $this->name . ".editor.scss';\n"
)
) {
Expand Down Expand Up @@ -274,14 +274,14 @@ private function create_block_assets() {
}

// copy styles.
if ( ! $this->init_filesystem()->copy( $asset_scss, ROOT_PATH . 'src/scss/blocks/custom/' . $this->name . '.scss' ) ) {
if ( ! $this->init_filesystem()->copy( $asset_scss, ROOT_PATH . 'assets/scss/blocks/custom/' . $this->name . '.scss' ) ) {
WP_CLI::error( 'ERROR :: Could not create styles file.', true );
}

// add js file for build process.
if (
! $this->init_filesystem()->put_contents(
ROOT_PATH . 'src/js/blocks/custom/' . $this->name . '.js',
ROOT_PATH . 'assets/js/blocks/custom/' . $this->name . '.js',
"import '../../../scss/blocks/custom/" . $this->name . ".scss';\n"
)
) {
Expand Down
26 changes: 26 additions & 0 deletions patterns/cta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Title: Centered Call To Action
* Slug: wd_s/cta;
* Categories: wds-patterns
*
* @package wd_s
*/

?>

<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"}}},"backgroundColor":"base-2","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide has-base-2-background-color has-background" style="padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)">
<!-- wp:heading {"textAlign":"center"} -->
<h2 class="wp-block-heading has-text-align-center"><?php echo esc_html_x( 'Get Started', 'Heading of the Call to Action', 'wd_s' ); ?></h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><?php echo esc_html_x( 'Stay in the loop with everything you need to know.', 'Description of the Call to Action', 'wd_s' ); ?></p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button"><?php echo esc_html_x( 'Learn More', 'Call to Action button text', 'wd_s' ); ?></a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
</div>
<!-- /wp:group -->
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const topLevelPhpFiles = glob.sync( './*.php' ),
directoryFiles = [
'./inc/*.php',
'./template-parts/*.php',
'./src/js/**/*.js',
'./assets/js/**/*.js',
];

const themeJsonPath = path.join( __dirname, 'theme.json' );
Expand Down
Loading

0 comments on commit 2645b23

Please sign in to comment.