MyThemes Wizard Wordpress Plugin - Rating, Reviews, Demo & Download

MyThemes Wizard Wordpress Plugin - Rating, Reviews, Demo & Download
No ratings yet
Free
Follow for free plugins, new theme releases and theme news

Plugin Description

myThemes Wizard is a free plugin that allows easily build your own custom Setup for any WordPress Themes and Plugins. This plugin is dedicated to WordPress developers. Themes and Plugins require additional support to can be integrate with myThemes Wizard Plugin.

Integration

To integrate features of this plugin with you theme, in functions.php, is need define 2 actions: register action and setup action.

Register Action eg:

function my_wizard_register( $wizard )
{
    ...
}

add_action( 'mythemes_wizard_register', 'my_wizard_register' );

Setup Action eg:

function my_wizard_setup( $wizard )
{
    ...
}

add_action( 'mythemes_wizard_setup', 'my_wizard_setup' );

In register action function you will include wizard Steps and Fields. You can define recommended plugins ( one of fields type ) and if user will check some of the plugin then on begin of the setup this plugin will be Installed and Activated automatically.

In setup action function you will use settings values collected from steps and field ( register function ) to setup different theme options create pages and posts.

Register Action Steps and Fields eg:

function my_wizard_register( $wizard )
{
    // Welcome Message
    $step = $wizard -> add_step( 'welcome', array(
        'type'  => 'zero',
        'title' => __( 'Welcome to Gourmand setup Wizard' ),
    ));

        {   // Step 0

            $step -> add_field( 'thanks-message', array(
                'type'      => 'html',
                'content'   =>
                    '<p>' . __( 'Thank you for choosing Gourmand WordPress Themes your choice is greatly appreciated! This quick setup wizard will help you configure the basic settings. It’s completely optional and shouldn’t take longer than five minutes.' ) . '</p>' .
                    '<p>' . __( 'Is very important to finish Setup. Between First and Last step the Wizard just collect settings and on last step, by click button Setup, the wizard apply settings and dependencies.' ) . '</p>' .
                    '<p>' . __( 'No time right now? If you don’t want to go through the wizard, you can skip and return to the WordPress dashboard. Come back anytime if you change your mind!' ) . '</p>'
            ));
        }

    // Website
    $step = $wizard -> add_step( 'website', array(
        'title' => __( 'Setup Website' )
    ));

        {   // Step 1

            // Content Width
            $step -> add_field( 'content-width', array(
                'type'      => 'select',
                'label' => __( 'Website Content Width' ),
                'default'   => 'large',
                'options'   => array(
                    'large'     => __( 'Large ( 1630px )' ),
                    'medium'    => __( 'Medium ( 1320px )', 'gourman' ),
                    'small'     => __( 'Small ( 890px )' )
                )
            ));

            $step -> add_field( 'website-type', array(
                'type'      => 'select',
                'label'     => __( 'Website Type' ),
                'ajax'      => true,
                'default'   => 'business',
                'options'   => array(
                    'business'  => __( 'Business' ),
                    'blog'      => __( 'Blog' )
                )
            ));

            {   // Business Tools

                // E-mail Address
                $step -> add_field( 'email', array(
                    'type'          => 'text',
                    'label'         => __( 'Contact E-Mail' ),
                    'callback'      => function( $wizard ){
                        return 'business' == $wizard -> get_setting( 'website-type' );
                    }
                ));

                // Address
                $step -> add_field( 'address', array(
                    'type'          => 'text',
                    'label'         => __( 'Contact Address' ),
                    'callback'      => function( $wizard ){
                        return 'business' == $wizard -> get_setting( 'website-type' );
                    }
                ));

                // Phone Number
                $step -> add_field( 'phone', array(
                    'type'          => 'text',
                    'label'         => __( 'Contact Phone' ),
                    'description'   => __( 'eg: + (0) 989 987 345' ),
                    'callback'      => function( $wizard ){
                        return 'business' == $wizard -> get_setting( 'website-type' );
                    }
                ));
            }

            $step -> add_field( 'personal-blog', array(
                'type'          => 'checkbox',
                'label'         => __( 'Personal Blog' ),
                'description'   => __( 'this option by default will disable author and author details from Blog Articles and Single Article.' ),
                'callback'      => function( $wizard ){
                    return 'blog' == $wizard -> get_setting( 'website-type' );
                }
            ));
        }

    // Pages
    $step = $wizard -> add_step( 'pages', array(
        'title'     => __( 'Setup Pages' ),
    ));

        {   // Step 2

            $step -> add_field( 'static-front-page', array(
                'type'          => 'checkbox',
                'label'         => __( 'Static Front Page' ),
                'description'   => __( 'Website Starter Page - first page will see your customers. This will be a static page where you can add details about your business.' ),
                'ajax'          => true,
                'default'       => function( $wizard ){
                    return absint( 'blog' !== $wizard -> get_setting( 'website-type' ) );
                },
                'callback'      => function( $wizard ){
                    return 'page' !== $wizard -> wp_option -> get( 'show_on_front' );
                }
            ));

            $step -> add_field( 'create-front-page', array(
                'type'          => 'checkbox',
                'label'         => __( 'Create Front Page' ),
                'description'   => __( 'Website Starter Page - first page will see your customers. This will be a static page where you can add details about your business' ),
                'ajax'          => true,
                'default'       => true,
                'callback'      => function( $wizard ){
                    $is_page_on_front = 'page' == $wizard -> wp_option -> get( 'show_on_front' );

                    return $wizard -> get_setting( 'static-front-page' ) && !$is_page_on_front;
                }
            ));

            $step -> add_field( 'front-page', array(
                'type'          => 'text',
                'description'   => __( 'choose your Front Page Title' ),
                'default'       => __( 'Front Page' ),
                'classes'       => 'padding-left-32',
                'callback'      => function( $wizard ){
                    $is_page_on_front   = 'page' == $wizard -> wp_option -> get( 'show_on_front' );
                    $create_front_page  = (bool)$wizard -> get_setting( 'create-front-page' );

                    return $wizard -> get_setting( 'static-front-page' ) && $create_front_page && !$is_page_on_front;
                }
            ));

            $step -> add_field( 'create-blog-page', array(
                'type'          => 'checkbox',
                'label'         => __( 'Create Blog Page' ),
                'description'   => __( 'Website Blog Page - here customers can see Blog Articles.' ),
                'ajax'          => true,
                'default'       => true,
                'callback'      => function( $wizard ){
                    $is_page_on_front = 'page' == $wizard -> wp_option -> get( 'show_on_front' );

                    return $wizard -> get_setting( 'static-front-page' ) && !$is_page_on_front;
                }
            ));

            $step -> add_field( 'blog-page', array(
                'type'          => 'text',
                'description'   => __( 'choose your Blog Title' ),
                'default'       => __( 'Blog' ),
                'classes'       => 'padding-left-32',
                'callback'      => function( $wizard ){
                    $is_page_on_front   = 'page' == $wizard -> wp_option -> get( 'show_on_front' );
                    $create_blog_page   = (bool)$wizard -> get_setting( 'create-blog-page' );

                    return $wizard -> get_setting( 'static-front-page' ) && $create_blog_page && !$is_page_on_front;
                }
            ));

            $step -> add_field( 'create-contact-page', array(
                'type'          => 'checkbox',
                'label'         => __( 'Create Contact Page' ),
                'description'   => __( 'here customers can write you an e-mail' ),
                'ajax'          => true,
                'default'       => true,
            ));

            $step -> add_field( 'contact-page', array(
                'type'          => 'text',
                'description'   => __( 'choose your Contact Title' ),
                'default'       => __( 'Contact' ),
                'classes'       => 'padding-left-32',
                'callback'      => function( $wizard ){
                    return $wizard -> get_setting( 'create-contact-page' );
                }
            ));
        }

    // Recommended Plugin
    $step = $wizard -> add_step( 'recommended-plugins', array(
        'type'      => 'setup',
        'title'     => __( 'Install &amp; Activate Recommended Plugins' )
    ));

        {   // Step 3

            $step -> add_field( 'contact-form-7', array(
                'type'          => 'plugin',
                'default'       => true
            ));

            $step -> add_field( 'easy-google-fonts', array(
                'type'          => 'plugin',
                'default'       => true
            ));

            $step -> add_field( 'loco-translate', array(
                'type'          => 'plugin',
                'default'       => true
            ));
        }
}

add_action( 'mythemes_wizard_register', 'my_wizard_register' );

So you can see in the example above a register function with 4 Steps:
– Step 0: Welcome Step
– Step 1: Website Setup
– Step 2: Create Pages
– Step 3: Install and Activate Recommended Plugins

Setup Action eg:

function my_wizard_setup( $wizard )
{
    /**
     *  Theme Mod Object
     *  Allow set, get and remove theme mods settings
     *  eg:
     *
     *  $theme_mod -> set( 'customize-link-setting', $value );
     *  $theme_mod -> get( 'customize-link-setting', $default ); // $default is optional
     *  $theme_mod -> remove( 'customize-link-setting' );
     */

    $theme_mod  = $wizard -> wp_theme_mod;


    /**
     *  Option Object
     *  Allow update, get and delete options
     *  eg:
     *
     *  $option -> update( 'option-setting', $value );
     *  $option -> get( 'option-setting', $default ); // $default is optional
     *  $option -> delete( 'option-setting' );
     */

    $option     = $wizard -> wp_option;


    // Set Theme Mod - nav-width
    $content_width = esc_attr( $wizard -> get_setting( 'content-width' ) );

    $theme_mod -> set( 'nav-width', esc_attr( $content_width ) );

    echo '<p class="setup-console">' . sprintf( __( 'Set content width: %1s' ), esc_attr( $content_width ) ) . '</p>';

    // Get Website Type
    $website_type = esc_attr( $wizard -> get_setting( 'website-type' ) );


    // Website Type Business
    if( $website_type == 'business' ){

        echo '<p class="setup-console">' . __( 'Website Type: Business' ) . '</p>';

        // Set Theme Mod - tools-email
        $email = $wizard -> get_setting( 'email' );

        if( !empty( $email ) && is_email( $email ) ){
            // enable - tools-display-email
            $theme_mod -> set( 'tools-display-email', true );

            // Set Theme Mod - tools-email
            $theme_mod -> set( 'tools-email', $email );

            echo '<p class="setup-console">' . __( 'Enable and Setup: Contact E-Mail' ) . '</p>';
        }

        // Set Theme Mod - tools-address
        $address = sanitize_text_field( $wizard -> get_setting( 'address' ) );

        if( !empty( $address ) ){
            // enable - tools-display-address
            $theme_mod -> set( 'tools-display-address', true );

            // Set Theme Mod - tools-address
            $theme_mod -> set( 'tools-address', $address );

            echo '<p class="setup-console">' . __( 'Enable and Setup: Contact Address' ) . '</p>';
        }

        // Set Theme Mod - tools-phone
        $phone = gourmand_esc::text( $wizard -> get_setting( 'phone' ) );

        if( !empty( $phone ) ){
            // enable - tools-display-menu-phone
            if( $content_width !== 'small' ){
                $theme_mod -> set( 'tools-display-menu-phone', true );
            }

            // enable - tools-display-email
            else{
                $theme_mod -> set( 'tools-display-phone', true );
            }

            // Set Theme Mod - tools-phone
            $theme_mod -> set( 'tools-phone', $phone );

            echo '<p class="setup-console">' . __( 'Enable and Setup: Contact Phone' ) . '</p>';
        }
    }

    // Website Type Blog
    else{

        if( (bool)$wizard -> get_setting( 'personal-blog' ) ){

            echo '<p class="setup-console">' . __( 'Website Type: Personal Blog' ) . '</p>';

            // Set Theme Mod / Option - blogname,
            if( (bool)$wizard -> get_setting( 'author-name' ) ){
                $display_name = get_the_author_meta( 'display_name', get_current_user_id() );
                $theme_mod -> set( 'blogname', $display_name );
                $options -> update( 'blogname', $display_name );

                echo '<p class="setup-console">' . sprintf( __( 'Setup Website Title: %1s' ), $display_name ) . '</p>';
            }

            // Set Theme Mod - blog-author, post-author, post-author-box
            if( (bool)$wizard -> get_setting( 'post-author' ) ){
                $theme_mod -> set( 'blog-author', false );
                $theme_mod -> set( 'post-author', false );
                $theme_mod -> set( 'post-author-box', false );

                echo '<p class="setup-console">' . __( 'Disable Post Meta: Author' ) . '</p>';
            }
        }

        else{
            echo '<p class="setup-console">' . __( 'Website Type: Blog' ) . '</p>';
        }

        // Set Theme Mod - blog-share, post-share
        if( (bool)$wizard -> get_setting( 'social-share' ) ){
            $theme_mod -> set( 'blog-share', true );
            $theme_mod -> set( 'post-share', true );

            echo '<p class="setup-console">' . __( 'Enable Blog and Post: Social Share Links' ) . '</p>';
        }
    }

    $pages = array();

    // Create Pages
    if( 'page' !== $option -> get( 'show_on_front' ) ){
        $static_front_page = (bool)$wizard -> get_setting( 'static-front-page' );

        if( $static_front_page ){
            $option -> update( 'show_on_front', 'page' );
            $theme_mod -> set( 'show_on_front', 'page' );

            echo '<p class="setup-console">' . sprintf( __( 'Static Front Page: %1s' ), $static_front_page ? __( 'TRUE' ) : __( 'FALSE' ) )  . '</p>';

            // Front Page
            $create_front_page  = (bool)$wizard -> get_setting( 'create-front-page' );
            $front_page         = $wizard -> get_setting( 'front-page' );

            if(  $create_front_page && !empty( $front_page ) ){
                $front_page_id = $wizard -> insert_post(array(
                    'post_title' => esc_html( $wizard -> get_setting( 'front-page' ) )
                ));

                if ( !empty( $front_page_id ) ) {
                    $option -> update( 'page_on_front', $front_page_id );

                    $p = get_post( $front_page_id );

                    echo '<p class="setup-console">' . sprintf( __( 'Create Page: %1s' ), $p -> post_title )  . '</p>';
                }

                array_push( $pages, $front_page_id );
            }

            // Blog Page
            $create_blog_page   = (bool)$wizard -> get_setting( 'create-blog-page' );
            $blog_page          = $wizard -> get_setting( 'blog-page' );

            if(  $create_blog_page && !empty( $blog_page ) ){
                $blog_page_id = $wizard -> insert_post(array(
                    'post_title' => esc_html( $wizard -> get_setting( 'blog-page' ) )
                ));

                if ( ! empty( $blog_page_id ) ) {
                    $option -> update( 'page_for_posts', $blog_page_id );

                    $p = get_post( $blog_page_id );

                    echo '<p class="setup-console">' . sprintf( __( 'Create Page: %1s' ), $p -> post_title )  . '</p>';
                }

                array_push( $pages, $blog_page_id );
            }
        }
    }

    // Contact Page
    $contact_form_7         = (bool)$wizard -> get_setting( 'contact-form-7' );
    $create_contact_page    = (bool)$wizard -> get_setting( 'create-contact-page' );
    $contact_page           = $wizard -> get_setting( 'contact-page' );

    if( $create_contact_page && !empty( $contact_page ) ){

        $form_id = 0;

        if( $contact_form_7 && class_exists( 'WPCF7_ContactForm' ) ){

            function gourmand_wpcf7_contact_page_form_properties( $properties, $obj )
            {
                $properties[ 'form' ] = trim(sprintf(
                    '<p>' . "n" .
                    '<label> %2$s %1$s' . "n" .
                    '[text* your-name] </label>' . "n" .
                    '</p>' . "nn" .

                    '<p>' . "n" .
                    '<label> %3$s %1$s' . "n" .
                    '[email* your-email] </label>' . "n" .
                    '</p>' . "nn" .

                    '<p>' . "n" .
                    '<label> %4$s' . "n" .
                    '[text your-subject] </label>' . "n" .

                    '<p>' . "n" .
                    '<label> %5$s' . "n" .
                    '[textarea your-message] </label>' . "n" .
                    '</p>' . "nn" .

                    '<p>' . "n" .
                    '[submit "%6$s"]' . "n" .
                    '</p>',

                    __( '(required)' ),
                    __( 'Your Name' ),
                    __( 'Your Email' ),
                    __( 'Subject' ),
                    __( 'Your Message' ),
                    __( 'Send Message' )
                ));

                $properties[ 'mail' ][ 'body' ] =

                    /* translators: %s: [your-name] <[your-email]> */
                    sprintf( __( 'From: %s', 'contact-form-7' ),
                        '[your-name] <[your-email]>' ) . "n"
                    /* translators: %s: [your-subject] */
                    . sprintf( __( 'Subject: %s', 'contact-form-7' ),
                        '[your-subject]' ) . "nn"
                    . __( 'Message Body:', 'contact-form-7' )
                        . "n" . '[your-message]' . "nn"
                    . '-- ' . "n"
                    /* translators: 1: blog name, 2: blog URL */
                    . sprintf(
                        __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ),
                        get_bloginfo( 'name' ),
                        get_bloginfo( 'url' ) )
                    . "Reservation Form";

                return $properties;
            }

            add_filter( 'wpcf7_contact_form_properties', 'gourmand_wpcf7_contact_page_form_properties', 10, 2 );

            $contact_form = WPCF7_ContactForm::get_template( array(
                'title' => __( 'Contact - Page' )
            ));

            $form_id = $contact_form -> save();

            WPCF7::update_option( 'bulk_validate', array(
                'timestamp'     => current_time( 'timestamp' ),
                'version'       => WPCF7_VERSION,
                'count_valid'   => 1,
                'count_invalid' => 0,
            ));

            echo '<p class="setup-console">' . sprintf( __( 'Create Form: %1s' ), __( 'Contact - Page' ) ) . '</p>';
        }

        $content =

        "<h2>Get in touch with us, write us an e-mail!</h2>nn" .
        "<p>If you have a purpose or you want to alert us about an issues in our theme then please contact us.n" .
        "You can use this contact form or you can contact us Through our Social Networks.</p>nnn";

        if( $form_id > 0 ){
            $content .= "

Error: Contact form not found.

"; } // Page $contact_page_id = $wizard -> insert_post(array( 'post_title' => esc_html( $wizard -> get_setting( 'contact-page' ) ), 'post_content' => $content )); $p = get_post( $contact_page_id ); echo '<p class="setup-console">' . sprintf( __( 'Create Page: %1s' ), $p -> post_title ) . '</p>'; array_push( $pages, $contact_page_id ); } /** * Create Menu */ if( count( $pages ) ){ $menu_name = __( 'Gourmand Header Menu' ); $menu_exists = wp_get_nav_menu_object( $menu_name ); if( !$menu_exists ){ $menu_id = wp_create_nav_menu( $menu_name ); foreach( $pages as $index => $page_id ){ $page = get_post( absint( $page_id ) ); wp_update_nav_menu_item( $menu_id, 0, array( 'menu-item-title' => $page -> post_title, 'menu-item-classes' => $page -> slug, 'menu-item-url' => get_permalink( $page -> ID ), 'menu-item-status' => 'publish' )); } $locations = get_nav_menu_locations(); $locations[ 'gourmand-header' ] = $menu_id; set_theme_mod( 'nav_menu_locations', $locations ); } echo '<p class="setup-console">' . sprintf( __( 'Create Menu: %1s' ), $menu_name ) . '</p>'; } } add_action( 'mythemes_wizard_setup', 'my_wizard_setup' );

Steps

Step type can be:

  • zero: not display step counter and navigation buttons will be “Not right Now” and “Let’s go!”
  • default: display step counter and navigation buttons will be “< Previous” and “Next >”
  • setup: display step counter and navigation buttons will be “< Previous” and “Setup” if click on button Setup will start automatically setup with Install & Activate selected Plugins and do_action( ‘mythemes_wizard_setup’ )
  • other: not display step counter and by default not display navigation buttons also you can include additional element “navigation” in step args eg:

    $wizard -> add_step( ‘donate-page’, array(
    ‘type’ => ‘other’,
    ‘title’ => __( ‘Setup is already finished !’ ),
    ‘navigation’ => array(
    array(
    ‘label’ => __( ‘Dashboard’ ),
    ‘url’ => esc_url( admin_url( ‘/’ ) )
    ),

        // OR / AND
        array(
            'action'    => 'prev-step',
        ),
        array(
            'action'    => 'next-step',
        ),
    
        // OR / AND
        array(
            'type' => 'primary',
            'label'     => __( 'Setup' ),
            'action'    => 'setup-step'
        ),
    
        // OR / AND
        array(
            'type'      => 'primary',
            'label'     => __( 'Customize Theme' ),
            'url'       => esc_url( admin_url( '/customize.php' ) )
        ),
    )
    

    ));

Fields

Fields type can be:

  • plugin – if is checked then Install and Activate Automatically on Start Setup.
  • checkbox
  • select
  • url
  • text
  • textarea
  • title
  • hint
  • html

Screenshots

No screenshots provided


Reviews & Comments