Created
March 13, 2024 16:41
-
-
Save taricco/c5a44dde4dae9b8789bf47b45cf63935 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** Custom function for posting a notice on the "Matchday" editing page | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
function wsv_matchday_notice_script() { | |
// Ensure we are on the admin screen to prevent errors on the front end | |
if (is_admin()) { | |
// Get the current screen object | |
$screen = get_current_screen(); | |
// Check if the current screen is for editing a 'page' | |
if ($screen->post_type == 'page') { | |
// Check if the $_GET['post'] is set and not empty, and the post ID is 5914 | |
if (isset($_GET['post']) && !empty($_GET['post']) && $_GET['post'] == 5897) { | |
wp_enqueue_script('wsv-matchday-notice', get_stylesheet_directory_uri() . '/includes/js/wsv_matchday_notice.js'); | |
} | |
} | |
} | |
} | |
add_action('enqueue_block_editor_assets', 'wsv_matchday_notice_script'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment