/** * Load styles and scripts. * * @access public */ public function admin_assets() { // make sure this doesn't load on any edit pages other than fm-overlays CPT edit pages. if (Fm_Overlays_Post_Type::instance()->get_post_type() === get_post_type()) { wp_enqueue_script('fm-overlays-admin-js', FM_OVERLAYS_ASSET_URL . '/static/js/fm-overlays-admin.js', array('jquery'), FM_OVERLAYS_ASSETS_VERSION, true); wp_enqueue_style('fm-overlays-admin-css', FM_OVERLAYS_ASSET_URL . '/static/css/fm-overlays-admin.css', array(), FM_OVERLAYS_ASSETS_VERSION); } }
{ $columns['menu_order'] = 'menu_order'; return $columns; } /** * Using pre_get_posts, make sure the overlays are * loading sorted by priority in the admin area * * @param object $query */ public function load_sorted_by_columns($query) { if (!is_admin() || get_query_var('post_type') !== $this->post_type) { return; } $query->set('orderby', 'menu_order date'); $query->set('order', 'DESC'); } /** * Gets the post type name used for fm overlays. * * @access public * @return string */ public function get_post_type() { return $this->post_type; } } Fm_Overlays_Post_Type::instance();
/** * Get Overlay Cookie Name * See global.js for cookie name * * @param int $overlay_id * @return string */ public static function get_overlay_cookie_name($overlay_id) { $cookie_name = Fm_Overlays_Post_Type::instance()->post_type . '-' . $overlay_id; return $cookie_name; }