PluginProbe
Admin Sticky Sidebar / trunk
Admin Sticky Sidebar vtrunk
1.8 1.7.2 trunk 1.3 1.3.1 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.7.1
admin-sticky-sidebar / admin-sticky-sidebar.php

admin-sticky-sidebar.php in Admin Sticky Sidebar trunk, at admin-sticky-sidebar.php

45 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Admin Sticky Sidebar
4 Description: Makes the sidebar follow you when you scroll and remembers scroll position on update. For more info, see the readme.
5 Version: 1.8
6 Author: Tom Walter
7 Author URI: https://littlefragments.com
8 License: GPLv2
9 */
10
11 // only load assets on classic post editor screens ----------------------------
12 function admin_sticky_sidebar_should_enqueue($hook)
13 {
14 if ($hook !== 'post.php' && $hook !== 'post-new.php') return false;
15
16 if (!function_exists('get_current_screen')) return true;
17
18 $screen = get_current_screen();
19 if ($screen && method_exists($screen, 'is_block_editor') && $screen->is_block_editor()) {
20 return false;
21 }
22
23 return true;
24 }
25
26 // add css to the admin --------------------------------------------------------
27 function admin_sticky_sidebar_css($hook)
28 {
29 if (!admin_sticky_sidebar_should_enqueue($hook)) return;
30
31 wp_enqueue_style('admin-sticky-sidebar-style', plugins_url('admin-sticky-sidebar.css', __FILE__), array(), '1.8');
32 }
33 add_action('admin_enqueue_scripts', 'admin_sticky_sidebar_css');
34
35
36
37 // add js to the admin ---------------------------------------------------------
38 function admin_sticky_sidebar_js($hook)
39 {
40 if (!admin_sticky_sidebar_should_enqueue($hook)) return;
41
42 wp_enqueue_script('admin-sticky-sidebar-script', plugins_url('admin-sticky-sidebar.js', __FILE__), array(), '1.8');
43 }
44 add_action('admin_enqueue_scripts', 'admin_sticky_sidebar_js');
45