Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taricco/c5a44dde4dae9b8789bf47b45cf63935 to your computer and use it in GitHub Desktop.
Save taricco/c5a44dde4dae9b8789bf47b45cf63935 to your computer and use it in GitHub Desktop.
/*** 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