PluginProbe
Time Clock – A WordPress Employee & Volunteer Time Clock Plugin / 1.2
Time Clock – A WordPress Employee & Volunteer Time Clock Plugin v1.2
trunk 1.0 1.0.1 1.1 1.1.1 1.1.2 1.2 1.2.1 1.2.2 1.2.3 1.3 1.3.1 1.3.2
time-clock / includes / admin / menu.php

menu.php in Time Clock – A WordPress Employee & Volunteer Time Clock Plugin 1.2, at includes/admin/menu.php

74 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5
6 // make admin menu
7 function etimeclockwp_plugin_menu() {
8
9 // pages
10 add_menu_page("Time Clock", "Time Clock", "manage_options", "etimeclockwp_menu", "etimeclockwp_dashboard",'dashicons-clock','28.5');
11 add_submenu_page("etimeclockwp_menu", __( 'Settings','etimeclockwp'), __('Settings','etimeclockwp'), "manage_options", "etimeclockwp_settings_page", "etimeclockwp_settings_page");
12 add_submenu_page('etimeclockwp_menu', __( 'Plugins', 'etimeclockwp' ), __( 'Plugins', 'etimeclockwp' ), 'manage_options', 'etimeclockwp_extensions_page', 'etimeclockwp_extensions_page' );
13
14 }
15 add_action("admin_menu", "etimeclockwp_plugin_menu");
16
17
18 // fix highlighting for dashboard submenu items
19 function etimeclockwp_select_highlight($file) {
20 global $plugin_page,$submenu_file;
21
22 $screen = get_current_screen();
23
24 if ($screen->post_type == 'etimeclockwp_clock') {
25 $plugin_page = 'edit.php?post_type=etimeclockwp_clock';
26 $submenu_file = 'edit.php?post_type=etimeclockwp_clock';
27 }
28
29 if ($screen->post_type == 'etimeclockwp_users') {
30 $plugin_page = 'edit.php?post_type=etimeclockwp_users';
31 $submenu_file = 'edit.php?post_type=etimeclockwp_users';
32 }
33
34 if ($screen->post_type == 'etimeclockwp_reports') {
35 $plugin_page = 'edit.php?post_type=etimeclockwp_users';
36 $submenu_file = 'time-clock_page_etimeclockwp_reports';
37 }
38
39 }
40 add_filter('parent_file', 'etimeclockwp_select_highlight');
41
42
43
44 function my_special_nav_class( $classes, $item ) {
45
46
47 echo "asdfasdfasdfasdfasdfasdf";
48
49 if ( is_single() && $item->title == 'Blog' ) {
50 $classes[] = 'special-class';
51 }
52
53 return $classes;
54
55 }
56
57 add_filter( 'nav_menu_css_class', 'my_special_nav_class', 10, 2 );
58
59
60 // plugin page links
61 function etimeclockwp_plugin_settings_link($links,$file) {
62
63 if ($file == 'time-clock/timeclock.php') {
64
65 $settings_link = '<a href="admin.php?page=etimeclockwp_settings_page">' . __('Settings', 'PTP_LOC') . '</a>';
66 $premium_link = '<a target="_blank" href="https://wpplugin.org/downloads/time-clock-pro/?utm_source=plugin-page&utm_medium=plugin&utm_campaign=etimeclockwp_plugins_page">' . __('Pro Version', 'PTP_LOC') . '</a>';
67
68 array_unshift($links, $settings_link);
69 array_push($links, $premium_link);
70 }
71
72 return $links;
73 }
74 add_filter('plugin_action_links', 'etimeclockwp_plugin_settings_link', 10, 2 );