Skip to content

Commit

Permalink
Add warning if theme is not a child theme.
Browse files Browse the repository at this point in the history
See #629
  • Loading branch information
joedolson committed Dec 17, 2024
1 parent 98bf9da commit e09abd4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/my-calendar-templating.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ function mc_php_templates_docs() {
wp_admin_notice( $message, array( 'type' => $type ) );
delete_transient( 'mc_file_copy' );
}
$theme = wp_get_theme();
$theme_name = $theme->get( 'Name' );
$theme_parent = $theme->get( 'Template' );
if ( '' === $theme_parent ) {
wp_admin_notice(
sprintf( __( 'Your current theme, %s, is not a child theme. Updates to your theme will delete custom My Calendar templates.', 'my-calendar' ), $theme_name ),
array(
'type' => 'error',
)
);
}

$intro = '<p>' . __( 'PHP templates are enabled. To customize templates, copy one or more of the following files into your theme directory.', 'my-calendar' ) . '</p>';
$intro .= '<p><a href="https://docs.joedolson.com/my-calendar/php-templates/">' . __( 'Read the documentation.', 'my-calendar' ) . '</a></p>';
$templates = array(
Expand Down

0 comments on commit e09abd4

Please sign in to comment.