WeddingDir
  • Getting Started
    • Introduction
    • Getting Started
    • Changelog
    • Installation
      • Step 1 - Download Theme
      • Step 2 - Install Theme
      • Step 3 - Import Demo Data
      • Step 4 - Permalink Setup
  • Theme Option
    • Theme Option
      • General Setting
        • Logo management
        • Website Loader
        • Enable Social Media Share
      • Header Setting
        • Header Version One
        • Header Version Two
        • Page Header Banner Setting
      • Typography Setting
        • Body Typography
        • Heading Typography
      • Style Setting
        • Body & Heading Style
        • Button Style Setting
        • Anchor Color Style
        • Star Rating Style
      • Vendor Setting
      • Couple Setting
        • WishList Setting
        • Todo List Setting
        • Guest List Management
        • Budget Calculator Tool
        • Real Wedding Tools
      • Listing Setting
      • Invoice Setting
      • Payment Gateway
        • PayPal Payment Setting
        • Stripe Payment Setting
        • PayFast Payment Gateway
        • RazorPay Payment Setting
        • PayStack Payment Setting
      • Map Setting
        • Google Map Setting
        • Leaflet Map Setting
      • Email Setting
        • Register Vendor Email
        • Register Couple Email
        • Forgot Password Email
        • Change Password Email
        • Email Helper
      • 404 Error Page
      • Footer Setting
        • Footer Columns Setting
        • Tiny Footer Setting
        • Footer Style Setting
        • Tiny Footer Style
      • Custom Code
  • Vendor Dashboard
    • Vendor Dashboard
      • Vendor Dashboard Tools
      • Vendor Listing Tools
        • My Listing Process
        • Add New Listing Process
        • Update Listing Process
      • Request Quote Tools
      • Pricing Plan Tools
      • Invoice Tools
      • Review Tools
      • My Profile Tools
  • Couple Dashboard
    • Couple Dashboard
      • Couple Dashboard Tools
      • Wishlist Tools
      • Todo ( Checklist ) Tools
      • Budget Calculator Tools
      • Guest List Tools
      • RealWedding Tools
      • My Profile Tools
  • TIPS & TRICKS
    • WordPress Hosting
    • For Support
    • Theme License
  • FAQ's
    • Listing Owner Information
    • How to Create Vendor User ?
    • How to Create Couple User ?
    • Listing Assign To Another User Process
    • Form Fields Modification
    • User - Configuration Process
      • Couple User
      • Vendor User
    • Social Login / Registration Configuration
    • Location Taxonomy Depth Level
  • Elementor Page Builder
    • Elementor Plugin
  • Translation
    • Loco Translation
  • How to Update Latest Version
    • Theme File Update
    • Plugins File Update
  • Create Dashboard Page
    • Couple Tools Page
    • Vendor Tools Page
Powered by GitBook
On this page
  1. Create Dashboard Page

Couple Tools Page

How to create couple dashboard menu and page of content.

Hello everyone,

If you are developer or you wish to create custom couple tools menu + pages. you can use this code in your functions.php file and start new page.

Thank you.

<?php
/**
 *  WeddingDir - Couple Dashboard Page
 *  ----------------------------------
 */
if( ! class_exists( 'WeddingDir_Couple_Dashboard_Page' ) && class_exists( 'WeddingDir_Config' ) ){

    /**
     *  WeddingDir - Couple Dashboard Page
     *  ----------------------------------
     */
    class WeddingDir_Couple_Dashboard_Page extends WeddingDir_Config{

        /**
         *  Member Variable
         *  ---------------
         */
        private static $instance;

        /**
         *  Initiator
         *  ---------
         */
        public static function get_instance() {
          
            if ( ! isset( self::$instance ) ) {

                self::$instance = new self;
            }

            return self::$instance;
        }

        /**
         *  Menu Name
         *  ---------
         */
        public static function menu_name(){

            return      esc_attr__( 'Couple Menu', 'text-domain' );
        }

        /**
         *  Menu Slug
         *  ---------
         */
        public static function menu_slug(){

            return      sanitize_title( 'couple-menu' );
        }

        /**
         *  Menu Icon
         *  ---------
         */
        public static function menu_icon(){

            return      esc_attr( 'weddingdir-budget' );
        }

        /**
         *  Construct
         *  ---------
         */
        public function __construct() {

            /**
             *  Create Menu
             *  -----------
             */
            add_filter( 'weddingdir/couple/dashboard/menu', [ $this, 'couple_menu' ], absint( '40' ), absint( '1' ) );

            /**
             *  Create Page
             *  -----------
             */
            add_action( 'weddingdir/couple-dashboard', [ $this, 'dashboard_page' ], absint( '40' ), absint( '1' ) );
        }

        /**
         *  Create Menu
         *  -----------
         */
        public static function couple_menu( $args = [] ){

            /**
             *  Menu Name
             *  ---------
             */
            $menu_name              =         self:: menu_name();

            /**
             *  Menu Slug
             *  ---------
             */
            $menu_slug              =         self:: menu_slug();

            /**
             *  Menu Icon
             *  ---------
             */
            $menu_icon              =         self:: menu_icon();

            /**
             *  Merge Menu Object
             *  -----------------
             */
            return      array_merge( $args, [  $menu_slug   =>   [

                            'menu_show'         =>      apply_filters( sprintf( 'weddingdir/couple-menu/%1$s/menu-show', $menu_slug ), true ),

                            'menu_class'        =>      apply_filters( sprintf( 'weddingdir/couple-menu/%1$s/menu-class', $menu_slug ), '' ),

                            'menu_id'           =>      apply_filters( sprintf( 'weddingdir/couple-menu/%1$s/menu-id', $menu_slug ), true ),

                            'menu_name'         =>      apply_filters( sprintf( 'weddingdir/couple-menu/%1$s/menu-name', $menu_slug ), $menu_name ),

                            'menu_icon'         =>      apply_filters( sprintf( 'weddingdir/couple-menu/%1$s/menu-icon', $menu_slug ), $menu_icon ),

                            'menu_active'       =>      parent:: dashboard_page_set( $menu_slug )  ?  sanitize_html_class( 'active' )  :  null,

                            'menu_link'         =>      apply_filters(  'weddingdir/couple-menu/page-link', esc_attr( $menu_slug )  )

                        ] ] );
        }

        /**
         *  Create Page
         *  -----------
         */
        public static function dashboard_page( $args = [] ){

            /**
             *  Have Args
             *  ---------
             */
            if( parent:: _is_array( $args ) ){

                /**
                 *  Extract
                 *  -------
                 */
                extract( wp_parse_args( $args,[

                    'layout'        =>      absint( '1' ),

                    'post_id'       =>      '',

                    'page'          =>      ''

                ] ) );

                /**
                 *  Make sure this page is couple dashboard page
                 *  --------------------------------------------
                 */
                if( ! empty( $page ) && $page == esc_attr( self:: menu_slug() )  ){

                    ?><div class="container"><?php

                        /**
                         *  2.1 Load Title
                         *  --------------
                         */
                        printf('<div class="section-title">

                                    <div class="d-sm-flex justify-content-between align-items-center">

                                        <h2 class="mb-xxl-0 mb-xl-0 mb-lg-0 mb-md-0 mb-sm-0 mb-3">%1$s</h2>

                                    </div>
                                    
                                </div>',

                                /**
                                 *  1. Title
                                 *  --------
                                 */
                                self:: menu_name()
                        );

                    ?></div><?php
                }
            }
        }


    } /* class end **/

   /**
    *  Kicking this off by calling 'get_instance()' method
    *  ---------------------------------------------------
    */
    WeddingDir_Couple_Dashboard_Page:: get_instance();
}

After this code used in your function file you will get same layout in vendor dashboard.

PreviousPlugins File UpdateNextVendor Tools Page

Last updated 8 months ago