Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@23cd9c1 from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Mar 4, 2024
1 parent c3890de commit c6f0eee
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 14 deletions.
4 changes: 2 additions & 2 deletions includes/decoded/class-decoded.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public function register_type() {
'label' => __( 'Decoded', 'text_domain' ),
'description' => __( 'A post type for Decoded blog posts.', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions' ),
'taxonomies' => array( 'formats' ),
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions', 'custom-fields' ),
'taxonomies' => array( 'category', 'research-teams', 'collection', 'languages', 'formats' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
Expand Down
9 changes: 3 additions & 6 deletions includes/gutenberg/class-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function load_gutenberg( $use_block_editor, $post ) {
/**
* Enable revisions for reusable blocks.
* @hook init
* @TODO: Look into this, I'm pretty sure a recent Gutenberg release defaulted to this.
*/
public function add_revisions_to_reusable_blocks() {
add_post_type_support( 'wp_block', 'revisions' );
Expand All @@ -91,12 +92,8 @@ public function group_admin_menus_together( $menu_order ) {
$new_menu_order = array();

$reorder = array(
'edit.php?post_type=topic-page', // Legacy
'edit.php?post_type=template-block', // Legacy
'edit.php?post_type=block_module', // New
'edit.php?post_type=wp_block', // Core Patterns
'edit.php?post_type=blockmeister_pattern', // Block Meister Patterns
'admin.php?page=blockmeister', // Block Meister Settings
'edit.php?post_type=block_module',
'edit.php?post_type=wp_block',
);

foreach ( $menu_order as $index => $item ) {
Expand Down
4 changes: 2 additions & 2 deletions includes/homepages/class-homepages.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ public function add_front_page_quick_edit( $admin_bar ) {
$admin_bar->remove_menu( 'edit' );
$admin_bar->add_menu(
array(
'id' => 'edit-homepage',
'title' => '<span class="ab-icon dashicons dashicons-admin-home"></span>' . _( 'Edit Homepage' ),
'id' => 'edit',
'title' => __( 'Edit Homepage' ),
'href' => $link,
'meta' => array(
'title' => __( 'Edit Homepage' ),
Expand Down
65 changes: 61 additions & 4 deletions includes/wp-admin/class-wp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function init($loader = null) {

$loader->add_action( 'admin_enqueue_scripts', $this, 'enqueue_assets' );
$loader->add_action( 'login_enqueue_scripts', $this, 'login_logo' );
$loader->add_action( 'wp_before_admin_bar_render', $this, 'admin_bar_tweaks' );
$loader->add_action( 'wp_before_admin_bar_render', $this, 'admin_bar_tweaks', 100 );
$loader->add_filter( 'get_user_option_admin_color', $this, 'default_admin_color_scheme' );
$loader->add_action( 'admin_print_footer_scripts', $this, 'admin_footer' );
$loader->add_filter( 'disabled_cookiepro', $this, 'disable_cookie_banner_conditions', 10, 1 );
Expand Down Expand Up @@ -90,7 +90,8 @@ public function login_logo() {
public function admin_bar_tweaks() {
global $wp_admin_bar;

$tools_id = 'prc-tools';
$tools_id = 'tools';
$edit_id = 'edit';

$vip_cache_tool = $wp_admin_bar->get_node('vip-purge-page');
if ( $vip_cache_tool ) {
Expand All @@ -115,6 +116,43 @@ public function admin_bar_tweaks() {
$wp_admin_bar->remove_node('parsely-stats');
}

$yoast_redirect_tool = $wp_admin_bar->get_node('wpseo-premium-create-redirect');
if ( $yoast_redirect_tool ) {
$yoast_redirect_tool->parent = $tools_id;
$yoast_redirect_tool = (array) $yoast_redirect_tool;
$wp_admin_bar->remove_node('wpseo-premium-create-redirect');
}

$my_account = $wp_admin_bar->get_node('my-account');
if ( $my_account ) {
// I actualy just want to remove the "Howdy" part of the greeting, make it just the username.
$my_account->title = str_replace('Howdy, ', '', $my_account->title);
// now remove the existing node and then add it back again with the updated title
$wp_admin_bar->remove_node('my-account');
$wp_admin_bar->add_node($my_account);
}

$site_editor = $wp_admin_bar->get_node('site-editor');
if ( $site_editor ) {
$site_editor->title = 'Edit Template';
// now remove the existing node and then add it back again with the updated title
$site_editor->parent = $edit_id;
$wp_admin_bar->remove_node('site-editor');
$wp_admin_bar->add_node($site_editor);
}

$search = $wp_admin_bar->get_node('search');
if ( $search ) {
$wp_admin_bar->remove_node('search');
}

$duplicate_post = $wp_admin_bar->get_node('duplicate-post');
if ( $duplicate_post ) {
$duplicate_post->parent = $tools_id;
$duplicate_post = (array) $duplicate_post;
$wp_admin_bar->remove_node('duplicate-post');
}

// create a new wp_admin bar node for my Attachments Report tool
$attachments_tool = array(
'id' => 'attachments-report',
Expand All @@ -126,7 +164,7 @@ public function admin_bar_tweaks() {
),
);

if ( $vip_cache_tool || $bitly_tool || $parsely_tool || $attachments_tool ) {
if ( $vip_cache_tool || $bitly_tool || $parsely_tool || $attachments_tool || $yoast_redirect_tool || $duplicate_post) {
$wp_admin_bar->add_menu(
array(
'id' => $tools_id,
Expand All @@ -147,6 +185,25 @@ public function admin_bar_tweaks() {
if ( $attachments_tool ) {
$wp_admin_bar->add_node( $attachments_tool );
}
if ( $yoast_redirect_tool ) {
$wp_admin_bar->add_node( $yoast_redirect_tool );
}
if ( $duplicate_post ) {
$wp_admin_bar->add_node( $duplicate_post );
}
}

// Organize an "Edit" menu

$edit = $wp_admin_bar->get_node('edit');
if ( !$edit ) {
$wp_admin_bar->add_menu(
array(
'id' => $edit_id,
'title' => 'Edit',
'href' => '#',
)
);
}

// Remove fwp cache, comments
Expand Down Expand Up @@ -208,7 +265,7 @@ public function admin_footer() {
global $post_type;
if ( isset( $post_type ) && is_string( $post_type ) ) {
// add the post type to the javascript global object window.prcEditorPostType
echo '<script>window.prcEditorPostType = "' . $post_type . '";</script>';
echo wp_sprintf( '<script>window.prcEditorPostType = "%s";</script>', esc_js($post_type) );
}
}

Expand Down

0 comments on commit c6f0eee

Please sign in to comment.