@@ 273-290 (lines=18) @@ | ||
270 | * @param string $domain Site domain. |
|
271 | * @param bool $calypso Optional. Whether links should point to Calypso or wp-admin. Default true (Calypso). |
|
272 | */ |
|
273 | public function add_posts_menu( $domain, $calypso = true ) { |
|
274 | if ( ! $calypso ) { |
|
275 | return; |
|
276 | } |
|
277 | ||
278 | $ptype_obj = get_post_type_object( 'post' ); |
|
279 | $menu_slug = 'https://wordpress.com/posts/' . $domain; |
|
280 | ||
281 | remove_menu_page( 'edit.php' ); |
|
282 | remove_submenu_page( 'edit.php', 'edit.php' ); |
|
283 | remove_submenu_page( 'edit.php', 'post-new.php' ); |
|
284 | ||
285 | 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 ); |
|
286 | add_submenu_page( $menu_slug, $ptype_obj->labels->all_items, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $menu_slug, null, 5 ); |
|
287 | 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 ); |
|
288 | ||
289 | $this->migrate_submenus( 'edit.php', $menu_slug ); |
|
290 | } |
|
291 | ||
292 | /** |
|
293 | * Adds Media menu. |
|
@@ 317-333 (lines=17) @@ | ||
314 | * @param string $domain Site domain. |
|
315 | * @param bool $calypso Optional. Whether links should point to Calypso or wp-admin. Default true (Calypso). |
|
316 | */ |
|
317 | public function add_page_menu( $domain, $calypso = true ) { |
|
318 | if ( ! $calypso ) { |
|
319 | return; |
|
320 | } |
|
321 | ||
322 | $ptype_obj = get_post_type_object( 'page' ); |
|
323 | $menu_slug = 'https://wordpress.com/pages/' . $domain; |
|
324 | ||
325 | remove_menu_page( 'edit.php?post_type=page' ); |
|
326 | remove_submenu_page( 'edit.php?post_type=page', 'edit.php?post_type=page' ); |
|
327 | remove_submenu_page( 'edit.php?post_type=page', 'post-new.php?post_type=page' ); |
|
328 | ||
329 | 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 ); |
|
330 | add_submenu_page( $menu_slug, $ptype_obj->labels->all_items, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $menu_slug, null, 5 ); |
|
331 | 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 ); |
|
332 | $this->migrate_submenus( 'edit.php?post_type=page', $menu_slug ); |
|
333 | } |
|
334 | ||
335 | /** |
|
336 | * Adds Comments menu. |