Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Admin Customisations for a 1-page WordPress website.

Admin Customisations for a 1-page WordPress website.

Sometimes we build WordPress sites that are just 1 pagers. These are quite popular at the moment. We spend a lot of time, making the front end experience exciting, with features such a parallax scrolling etc. However we often neglect the admin leaving it as the default experience. In this talk I outline how I have removed a lot of the bloated admin interface which is not needed for a 1 page WordPress site making the editor experience much better.

31af50af29856a3e6734bdae0a0d68cf?s=128

Mark Wilkinson

November 22, 2015
Tweet

Transcript

  1. WORDPRESS ADMIN CUSTOMISATIONS For a 1-page Website Mark Wilkinson |

    markwilkinson.me | @wpmark
  2. It’s All About The FRONT END

  3. OR IS IT?

  4. None
  5. WORDPRESS to the rescue

  6. None
  7. THE GOAL Everything editable from one screen Remove the admin

    clutter Still allow full access for some users
  8. None
  9. None
  10. MY PLAN 1 2 3 4 5 6 7

  11. 1 Edit Post/Page Edit Screen

  12. 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' );
  13. 2 Add Page Meta Boxes Header Content Services Footer

  14. 2 Add Page Meta Boxes

  15. 3 Remove Top Level Menus Posts Pages Appearance Comments Plugins

    Settings
  16. 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' );
  17. 4 Add Top Level Menus Content – Post edit screen

    for home page Menus – move from Appearance to top level menu
  18. 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' );
  19. 5 Edit Capabilities Add New – prevent users from adding

    new pages using this button
  20. 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' );
  21. 6 Correct the Admin Bar View Site View Admin

  22. 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' );
  23. 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 );
  24. The Result

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

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

    for hire!
  28. #wpcumbria wpcumbria.com