Skip to content

Add view transitions for WP Admin #2038

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

Merged
merged 20 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions plugins/view-transitions/includes/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Admin related functions for View Transitions.
*
* @package view-transitions
* @since 1.0.0
*/

// @codeCoverageIgnoreStart
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// @codeCoverageIgnoreEnd

/**
* Outputs the necessary CSS styles for view transitions.
*
* This function is responsible for printing the required inline styles
* to enable or enhance view transitions within the theme or plugin.
* It should be hooked to an appropriate action to ensure the styles
* are included in the page output.
*
* @since n.e.x.t
*/
function plvt_print_view_transitions_admin_style(): void {
$options = plvt_get_stored_setting_value();
if ( ! isset( $options['enable_admin_transitions'] ) || true !== $options['enable_admin_transitions'] ) {
return;
}
?>
<style>
@view-transition { navigation: auto; }
</style>
<?php
}
22 changes: 0 additions & 22 deletions plugins/view-transitions/includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,25 +355,3 @@ function plvt_load_view_transitions(): void {
wp_add_inline_script( 'plvt-view-transitions', $init_script );
wp_enqueue_script( 'plvt-view-transitions' );
}

/**
* Outputs the necessary CSS styles for view transitions.
*
* This function is responsible for printing the required inline styles
* to enable or enhance view transitions within the theme or plugin.
* It should be hooked to an appropriate action to ensure the styles
* are included in the page output.
*
* @since n.e.x.t
*/
function plvt_print_view_transitions_admin_style(): void {
$options = plvt_get_stored_setting_value();
if ( ! isset( $options['enable_admin_transitions'] ) || true !== $options['enable_admin_transitions'] ) {
return;
}
?>
<style>
@view-transition { navigation: auto; }
</style>
<?php
}
1 change: 1 addition & 0 deletions plugins/view-transitions/view-transitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
define( 'VIEW_TRANSITIONS_VERSION', '1.0.1' );
define( 'VIEW_TRANSITIONS_MAIN_FILE', __FILE__ );

require_once __DIR__ . '/includes/admin.php';
require_once __DIR__ . '/includes/class-plvt-view-transition-animation.php';
require_once __DIR__ . '/includes/class-plvt-view-transition-animation-registry.php';
require_once __DIR__ . '/includes/functions.php';
Expand Down