September 15, 2023

Create a Custom WordPress Dashboard for Your Clients Using GenerateBlocks & Code Snippets

Play Video
Tutorial Walkthrough
This video tutorial provides an in-depth walkthrough, and we recommend following along with the video to grasp the concept fully. Below, you'll find a summary of the tutorial, but please note that it may leave out some detailed steps, so watching the video will give you the most comprehensive understanding.

If you’ve ever wished for a more streamlined experience when your clients log into their WordPress site, you’re in the right place. Today, we’re exploring the process of creating a custom WordPress dashboard using GenerateBlocks and Code Snippets. Follow along and create your own dashboard.


Why a Custom WordPress Dashboard?

The default WordPress dashboard, while powerful, can be a maze for clients unfamiliar with its intricacies. A custom dashboard:

  • Simplifies Navigation
    Clients can find what they need without sifting through unnecessary options.
  • Enhances User Experience
    A tailored dashboard feels welcoming and reduces the learning curve.
  • Reflects Professionalism
    It shows you’ve gone the extra mile to make things easier for your clients.

Designing Your WordPress Client Dashboard

A well-designed dashboard is like a well-organized workspace. It boosts productivity and reduces frustration.

  • Blueprint
    Start with a clear vision. What do your clients access the most? Prioritize those.
  • Hero Section
    This is the main welcome area. Maybe add a welcome message or a quick tutorial video.
  • Main Content Container
    This is where the bulk of your links and tools will reside. Using GenerateBlocks, you can:
    – Use grid blocks for a neat layout.
    – Organize content with containers, ensuring each section is clearly defined.

Linking Essential Functions

Quick access links are the backbone of your dashboard.

  • Posts & Pages:
    – Add new post: /wp-admin/post-new.php
    – Edit posts: /wp-admin/edit.php
  • Analytics
    Set up a quick link for clients to view their site’s performance.

Tip: Using relative links (those starting with /wp-admin/...) ensures that the dashboard is portable. If you migrate the site or change its domain, the links will still work without any extra effort.


Incorporating Video Tutorials

Think of these as on-demand training sessions.

  • Generic Tutorials
    These are the basics. For instance, “How to create a post” or “How to upload an image”.
  • Specific Tutorials
    Tailored to unique client needs. Maybe they have a custom product gallery or a unique booking system.
  • Embedding
    Use the YouTube block to embed videos. It’s straightforward and ensures that the client doesn’t have to leave the dashboard to learn.

Implementing Code for Dashboard Functionality

Using the Code Snippets Plugin allows you to add custom functions without editing theme files. Simply install it, and then:

  1. Go to ‘Add New’ under the ‘Snippets’ menu.
  2. Name your snippet for easy reference.
  3. Copy and paste the code below:
    // 1. Redirect logged-out users who try to visit '/dashboard' to the login page.
    function redirect_dashboard_to_login() {
        if ( is_page('dashboard') && !is_user_logged_in() ) {
            wp_redirect( wp_login_url() );
            exit;
        }
    }
    add_action( 'template_redirect', 'redirect_dashboard_to_login' );
    
    // 2. Redirect non-administrator users to '/dashboard' when they log in.
    function redirect_non_admin_users_on_login( $redirect_to, $request, $user ) {
        // Is there a user to check?
        if ( isset( $user->roles ) && is_array( $user->roles ) ) {
            // If the user is an administrator, let them stay on the backend
            if ( in_array( 'administrator', $user->roles ) ) {
                return $redirect_to;
            } else {
                // Otherwise, redirect them to '/dashboard'
                return home_url( '/dashboard' );
            }
        } else {
            return $redirect_to;
        }
    }
    add_filter( 'login_redirect', 'redirect_non_admin_users_on_login', 10, 3 );
    
    // 3. Remove the admin bar for non-administrator users.
    function hide_admin_bar_from_non_admins() {
        if ( ! current_user_can( 'administrator' ) ) {
            show_admin_bar( false );
        }
    }
    add_action( 'init', 'hide_admin_bar_from_non_admins', 9 );
    

    Source: GoOnlineTools

  4. Save and activate.

Tip: If you decide not to use ‘dashboard’ as the slug, remember to update the code snippets accordingly. The slug is the URL’s tail end, and the code will reference this to function correctly.


In Conclusion

Building a custom WordPress dashboard isn’t just about aesthetics or decluttering. It’s about creating an environment where your clients feel empowered, and where they can manage their content without feeling overwhelmed. It’s a small change with a significant impact. Give it a try and see the difference it makes!

Required Resources

GenerateBlocks Logo
Free Options
Code Snippets Logo
Free Options
Credit to The Admin Bar
The Admin Bar is a resourceful platform dedicated to WordPress. From insightful videos on optimizing your WordPress tech stack to creative hacks for faster web page creation, the channel is a treasure trove for both beginners and advanced WordPress users.
Visit
Create a Custom WordPress Dashboard for Your Clients Using GenerateBlocks & Code Snippets
Welcome back!
Enter your Helwp credentials to sign in.

No Account yet? Sign Up

My Account
Menu
Give Feedback
Describe your feedback *
Rate Helwp
Share
Facebook
Twitter
LinkedIn
Reddit
Email
WhatsApp
Telegram
Pocket
Report
Problem *
Describe the problem
Want us to reply?
Your E-Mail
Affiliate Disclosure

At Helwp, we’re committed to transparency and honesty. Therefore, we want to inform you that some of the links on our website are affiliate links. This means that, at no additional cost to you, we may earn a small commission if you click through and make a purchase.

We only promote products or services that we genuinely believe in. These affiliate commissions help us to maintain the website and continue to provide you with free, high-quality WordPress content.

If you are interested in how you can support us even further, check out our support page.