Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Child Theme Support #50

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

claytoncollie
Copy link
Contributor

Description of the Change

Work in progress to support child themes based on #46

Verification Process

Test by installing a basic theme following Core handbook named 10up-child-theme

index.php

<?php
/**
 * The main template file
 *
 * @package TenUpChildTheme
 */

get_header(); ?>

	<?php if ( have_posts() ) : ?>
		<?php while ( have_posts() ) : the_post(); ?>
			<h2><?php the_title(); ?></h2>
			<?php the_content(); ?>
		<?php endwhile; ?>
	<?php endif; ?>

<?php
get_footer();

style.css

/**
 * Theme Name:  10up Child Theme
 * Theme URI:   https://10up.com
 * Description: Project description.
 * Author:      10up
 * Author URI:  https://10up.com
 * Version:     0.1.0
 * Text Domain: tenup-child-theme
 * Template:    10up-theme
 */

functions.php

add_action(
	'wp_enqueue_scripts',
	function {
		wp_enqueue_style(
			'tenup_theme_style',
			get_template_directory_uri() . '/style.css',
			array(),
			'1.0.0'
		);
		wp_enqueue_style(
			'tenup_theme_child_style',
			get_stylesheet_uri(),
			array( 'tenup_theme_style' ),
			'1.0.0'
		);
	}
);

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Change script and style handle names to use theme name

@claytoncollie claytoncollie self-assigned this Aug 25, 2021
@claytoncollie claytoncollie linked an issue Aug 27, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Child Theme Support
2 participants