Skip to content
Merged
Prev Previous commit
Next Next commit
Only render the override UI control if relevant.
  • Loading branch information
felixarntz committed Jun 5, 2025
commit c84d24d9abad8bd3bcda14814078e14568e7616a
8 changes: 8 additions & 0 deletions plugins/view-transitions/includes/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ function plvt_apply_settings_to_theme_support(): void {
* @access private
*/
function plvt_add_setting_ui(): void {
global $plvt_has_theme_support_with_args;

add_settings_section(
'plvt_view_transitions',
__( 'View Transitions', 'view-transitions' ),
Expand Down Expand Up @@ -301,6 +303,12 @@ static function (): void {
'description' => __( 'Provide the CSS selector to detect the post content element.', 'view-transitions' ),
),
);

// Do not render the checkbox to override if there is no thing to override.
if ( ! $plvt_has_theme_support_with_args ) {
unset( $fields['override_theme_config'] );
}

foreach ( $fields as $slug => $args ) {
add_settings_field(
"plvt_view_transitions_{$slug}",
Expand Down