@@ 289-306 (lines=18) @@ | ||
286 | * @param string $domain Site domain. |
|
287 | * @param bool $calypso Optional. Whether links should point to Calypso or wp-admin. Default true (Calypso). |
|
288 | */ |
|
289 | public function add_posts_menu( $domain, $calypso = true ) { |
|
290 | if ( ! $calypso ) { |
|
291 | return; |
|
292 | } |
|
293 | ||
294 | $ptype_obj = get_post_type_object( 'post' ); |
|
295 | $menu_slug = 'https://wordpress.com/posts/' . $domain; |
|
296 | ||
297 | remove_menu_page( 'edit.php' ); |
|
298 | remove_submenu_page( 'edit.php', 'edit.php' ); |
|
299 | remove_submenu_page( 'edit.php', 'post-new.php' ); |
|
300 | ||
301 | add_menu_page( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->labels->menu_name, $ptype_obj->cap->edit_posts, $menu_slug, null, 'dashicons-admin-post', $ptype_obj->menu_position ); |
|
302 | add_submenu_page( $menu_slug, $ptype_obj->labels->all_items, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $menu_slug, null, 5 ); |
|
303 | add_submenu_page( $menu_slug, $ptype_obj->labels->add_new, $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, 'https://wordpress.com/post/' . $domain, null, 10 ); |
|
304 | ||
305 | $this->migrate_submenus( 'edit.php', $menu_slug ); |
|
306 | } |
|
307 | ||
308 | /** |
|
309 | * Adds Media menu. |
|
@@ 333-349 (lines=17) @@ | ||
330 | * @param string $domain Site domain. |
|
331 | * @param bool $calypso Optional. Whether links should point to Calypso or wp-admin. Default true (Calypso). |
|
332 | */ |
|
333 | public function add_page_menu( $domain, $calypso = true ) { |
|
334 | if ( ! $calypso ) { |
|
335 | return; |
|
336 | } |
|
337 | ||
338 | $ptype_obj = get_post_type_object( 'page' ); |
|
339 | $menu_slug = 'https://wordpress.com/pages/' . $domain; |
|
340 | ||
341 | remove_menu_page( 'edit.php?post_type=page' ); |
|
342 | remove_submenu_page( 'edit.php?post_type=page', 'edit.php?post_type=page' ); |
|
343 | remove_submenu_page( 'edit.php?post_type=page', 'post-new.php?post_type=page' ); |
|
344 | ||
345 | add_menu_page( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->labels->menu_name, $ptype_obj->cap->edit_posts, $menu_slug, null, 'dashicons-admin-page', $ptype_obj->menu_position ); |
|
346 | add_submenu_page( $menu_slug, $ptype_obj->labels->all_items, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $menu_slug, null, 5 ); |
|
347 | add_submenu_page( $menu_slug, $ptype_obj->labels->add_new, $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, 'https://wordpress.com/page/' . $domain, null, 10 ); |
|
348 | $this->migrate_submenus( 'edit.php?post_type=page', $menu_slug ); |
|
349 | } |
|
350 | ||
351 | /** |
|
352 | * Adds Comments menu. |