Slide 1

Slide 1 text

WORDPRESS ADMIN CUSTOMISATIONS For a 1-page Website Mark Wilkinson | markwilkinson.me | @wpmark

Slide 2

Slide 2 text

It’s All About The FRONT END

Slide 3

Slide 3 text

OR IS IT?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

WORDPRESS to the rescue

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

THE GOAL Everything editable from one screen Remove the admin clutter Still allow full access for some users

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

MY PLAN 1 2 3 4 5 6 7

Slide 11

Slide 11 text

1 Edit Post/Page Edit Screen

Slide 12

Slide 12 text

1 Edit Post/Page Edit Screen function wpaop_remove_editor_on_pages() { remove_post_type_support( 'page', 'editor' ); remove_post_type_support( 'page', 'page-attributes' ); remove_post_type_support( 'page', 'title' ); } add_action( 'admin_init', 'wpaop_remove_editor_on_pages' );

Slide 13

Slide 13 text

2 Add Page Meta Boxes Header Content Services Footer

Slide 14

Slide 14 text

2 Add Page Meta Boxes

Slide 15

Slide 15 text

3 Remove Top Level Menus Posts Pages Appearance Comments Plugins Settings

Slide 16

Slide 16 text

3 Remove Top Level Menus function wpaop_remove_admin_menus( $menus ) { $menus[] = 'edit.php'; $menus[] = 'edit.php?post_type=page'; $menus[] = 'themes.php'; $menus[] = 'wpbasis_dashboard'; return $menus; } add_filter( 'wpbasis_remove_admin_menus', 'wpaop_remove_admin_menus' );

Slide 17

Slide 17 text

4 Add Top Level Menus Content – Post edit screen for home page Menus – move from Appearance to top level menu

Slide 18

Slide 18 text

4 Remove Top Level Menus function wpaop_add_admin_pages() { if( wpbasis_is_wpbasis_user() ) { return; } add_menu_page( Content’,'Content’,'edit_posts’,'post.php? post=2&action=edit’, '’, 'dashicons-admin-page’, 9 ); add_menu_page( Menus’,’Menus’,'edit_posts’,’nav-menus.php’, '’, 'dashicons-menu’, 61 ); } add_action( 'admin_menu', 'wpaop_add_admin_pages' );

Slide 19

Slide 19 text

5 Edit Capabilities Add New – prevent users from adding new pages using this button

Slide 20

Slide 20 text

5 Edit Capabilities function wpaop_caps( $caps ) { $caps[ 'edit_pages' ] = array( 'name' => 'edit_pages', 'action' => false, ); return $caps; } add_filter( 'wpbasis_user_capabilities', 'wpaop_caps' );

Slide 21

Slide 21 text

6 Correct the Admin Bar View Site View Admin

Slide 22

Slide 22 text

6 Correct the Admin Bar function wpaop_admin_bar_admin_url() { if( is_admin() ) { return home_url( '/' ); } else { $home_id = get_option( 'page_on_front', 2 ); /* return the new login redirect location */ return admin_url( 'post.php?post=' . absint( $home_id ) . '&action=edit' ); } } add_filter( 'wpbasis_admin_bar_site_admin_link_url', 'wpaop_admin_bar_admin_url' );

Slide 23

Slide 23 text

7 Redirect on Successful Login function wpaop_login_redirect( $redirect_to, $request, $user ) { $home_id = get_option( 'page_on_front', 2 ); return admin_url( 'post.php?post=' . absint( $home_id ) . '&action=edit' ); } add_filter( 'login_redirect', ‘wpaop_login_redirect', 10, 3 );

Slide 24

Slide 24 text

The Result

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

https://github.com/wpmark/wp-admin-one-pager

Slide 27

Slide 27 text

Thank you Questions? @wpmark markwilkinson.me github.com/wpmark profiles.wordpress.org/wpmarkuk P.S. I’m available for hire!

Slide 28

Slide 28 text

#wpcumbria wpcumbria.com