/** * Print an Index Pages settings field. * * @since 1.0.0 * * @param */ public static function do_settings_field($args) { extract($args); wp_dropdown_pages(array('selected' => Registry::get_index_page($post_type), 'name' => $label_for, 'id' => $label_for, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'plugin-context' => 'index-pages')); }
/** * Add an Edit Index Page button to the admin bar if applicable. * * @since 1.0.0 * * @param WP_Admin_Bar $wp_admin_bar The admin bar object. */ public static function add_edit_button(\WP_Admin_Bar $wp_admin_bar) { // Abort if not an archive for the supported post types if (!is_post_type_archive()) { return; } // Abort if an edit node already exists if ($wp_admin_bar->get_node('edit')) { return; } // Get the page post type object $post_type_object = get_post_type_object('page'); // If an index is found, is editable, and has an edit link, add the edit button. if (($index_page = Registry::get_index_page(get_query_var('post_type'))) && current_user_can('edit_post', $index_page) && ($edit_post_link = get_edit_post_link($index_page))) { $wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => $edit_post_link)); } }