', apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-addons', 'wprss_addons_page_display' ); }, 50); add_action('admin_menu', function () { add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Help & Support', WPRSS_TEXT_DOMAIN ), __( 'Help & Support', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-help', 'wprss_help_page_display' ); }, 60); // Hides the "Add New" submenu add_action('admin_menu', function () { global $submenu; unset( $submenu['edit.php?post_type=wprss_feed'][10] ); }); add_filter('admin_body_class', 'wprss_base_admin_body_class'); /** * Set body class for admin screens * http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/ * @since 2.0 */ function wprss_base_admin_body_class( $classes ) { // Current action if ( is_admin() && isset($_GET['action']) ) { $classes .= 'action-'.$_GET['action']; } // Current post ID if ( is_admin() && isset($_GET['post']) ) { $classes .= ' '; $classes .= 'post-'.$_GET['post']; } // New post type & listing page if ( isset($_GET['post_type']) ) $post_type = $_GET['post_type']; if ( isset($post_type) ) { $classes .= ' '; $classes .= 'post-type-'.$post_type; } // Editting a post type if ( isset( $_GET['post'] ) ) { $post_query = $_GET['post']; } if ( isset($post_query) ) { $current_post_edit = get_post($post_query); $current_post_type = $current_post_edit->post_type; if ( !empty($current_post_type) ) { $classes .= ' '; $classes .= 'post-type-'.$current_post_type; } } // Return the $classes array return $classes; } /** * Change title on wprss_feed post type screen * * @since 2.0 * * @param string $original The original title placeholder. * * @return string */ function wprss_change_title_text($original) { if (get_post_type() === 'wprss_feed') { return __('Name this feed (e.g. WP Mayor)', WPRSS_TEXT_DOMAIN); } return $original; } add_filter( 'plugin_action_links', 'wprss_plugin_action_links', 10, 2 ); /** * Add Settings action link in plugin listing * * @since 3.0 * @param array $action_links * @param string $plugin_file * @return array */ function wprss_plugin_action_links( $action_links, $plugin_file ) { // check to make sure we are on the correct plugin if ( $plugin_file == 'wp-rss-aggregator/wp-rss-aggregator.php' ) { // the anchor tag and href to the URLs we want. $settings_link = '' . __( 'Settings', WPRSS_TEXT_DOMAIN ) . ''; $docs_link = '' . __( 'Documentation', WPRSS_TEXT_DOMAIN ) . ''; // add the links to the beginning of the list array_unshift( $action_links, $settings_link, $docs_link ); } return $action_links; } /** * Function for registering application's scripts that depends on advanced libraries. * It will enqueue manifest and vendor scripts, which contains all required logic * for bootstrapping application and dependencies. * * Use only for Vue-related apps that use Webpack for being built. * * @since 4.12.1 * * @param $handle * @param string $src * @param array $deps * @param bool $ver * @param bool $in_footer */ function wprss_plugin_enqueue_app_scripts( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) { /* * Manifest file holds function used for bootstrapping and ordered * loading of dependencies and application. */ wp_enqueue_script('wpra-manifest', WPRSS_APP_JS . 'wpra-manifest.min.js', array(), '0.1', true); /* * Vendor file holds all common dependencies for "compilable" applications. * * For example, `intro` pages application's and plugin's page application's files * holds only logic for that particular application. Common dependencies like Vue * live in this file and loaded before that application. */ wp_enqueue_script('wpra-vendor', WPRSS_APP_JS . 'wpra-vendor.min.js', array( 'wpra-manifest' ), '0.1', true); /* * Enqueue requested script. */ $deps = array_merge(array( 'wpra-manifest', 'wpra-vendor', ), $deps); wp_enqueue_script($handle, $src, $deps, $ver, $in_footer); }