Skip to content

Commit 914d8b2

Browse files
authored
Add theme header comparison check to compatibility logic (#76)
* Add theme header comparison check to compatibility logic * Fix a typo * Improve user feedback during theme compatibility checks * Slight reword as proposed
1 parent 450ec86 commit 914d8b2

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

lib/admin-page.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,35 @@ function classicpress_check_can_migrate() {
459459
echo "<tr>\n<td>$icon_preflight_fail</td>\n<td>\n";
460460
printf( __(
461461
/* translators: active theme name */
462-
'It looks like you are using the <strong>%1$s</strong> theme. Unfortuantely it is incompatible with ClassicPress.',
462+
'It looks like you are using the <strong>%1$s</strong> theme. Unfortunately it is incompatible with ClassicPress.',
463463
'switch-to-classicpress'
464464
), $theme->name );
465465
echo "<br>\n";
466466
_e(
467467
'Consider switching to a different theme, perhaps an older core theme, and try again.',
468468
'switch-to-classicpress'
469469
);
470+
} elseif ( empty ( $theme->get( 'RequiresWP' ) ) ) {
471+
$preflight_checks['theme'] = true;
472+
echo "<tr>\n<td>$icon_preflight_warn</td>\n<td>\n";
473+
printf( __(
474+
/* translators: active theme name */
475+
'It looks like you are using the <strong>%1$s</strong> theme. We cannot be sure it is compatible with ClassicPress because it is not declaring a minimum required version of WordPress.',
476+
'switch-to-classicpress'
477+
), $theme->name );
478+
} elseif ( version_compare( $theme->get( 'RequiresWP' ), '5.0' ) >= 0 ) {
479+
$preflight_checks['theme'] = false;
480+
echo "<tr>\n<td>$icon_preflight_fail</td>\n<td>\n";
481+
printf( __(
482+
/* translators: active theme name */
483+
'It looks like you are using the <strong>%1$s</strong> theme. Unfortunately it seems it requires WordPress %2$s or above and it may therefore be incompatible with ClassicPress.',
484+
'switch-to-classicpress'
485+
), $theme->name, $theme->get( 'RequiresWP' ) );
486+
echo "<br>\n";
487+
_e(
488+
'Consider switching to a different theme, perhaps an older core theme, and try again.',
489+
'switch-to-classicpress'
490+
);
470491
} else {
471492
$preflight_checks['theme'] = true;
472493
echo "<tr>\n<td>$icon_preflight_warn</td>\n<td>\n";

0 commit comments

Comments
 (0)