• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

How to Disable Import theme demo option in wordpress

xlx

Active member
Dec 13, 2018
190
82
28
Hello,

I needed some help with wordpress. So many a times when we hand over the site / deploy it on the clients hosting, we share the admin level access.
The clients do know its a purchased theme, but every once in a while a client would like to explore the backend and mess things up.

In a couple of instances the client has gone ahead and clicked the Import demo / one click demo install etc. and overwritten the site.
Could you guys help me in figuring out where this option is generally set in the theme files. (I understand each theme developer might have a different coding standard) so that i can disable it and grant access.

Thanks for helping
 
No theme is the same, so there's no general rule.

Some themes use Unyson Framework for their demo content imports. If that's the case then simply de-activate the extension 'Backup & Demo Content'.

A better approach might be to restrict access to certain menu items even though they have admin rights. You do that in functions.php, checking for the admin ID. E.g. when your admin ID is '1' (and if you're the first registered admin, it usually is) do something like:

PHP:
function exclude_admins() {
    $current_user_id = get_current_user_id();
        if (is_admin() && ($current_user_id != 1) )
        {
            // exclude menu items or buttons here
        }
}
add_action( 'init', 'exclude_admins', 999 );

NOTE: despite its name the function 'is_admin' does NOT check whether the user is an administrator but whether the user is in the administration interface (the backend).
 
  • Love
Reactions: xlx
Thanks a ton Bro, will check this out.

Appreciate your help
 
@frizzel , bro i tried adding the code at the end of the functions file but it did not work.
could you show me where to add it correctly

The Option that i need to hide is 'Install Demo Data'
and is seen under Appearance > Install Demo Data

PHP:
<?php
/**
 * Theme sprecific functions and definitions
 */

/* Theme setup section
------------------------------------------------------------------- */

// Set the content width based on the theme's design and stylesheet.
if ( ! isset( $content_width ) ) $content_width = 1170; /* pixels */

// Add theme specific actions and filters
// Attention! Function were add theme specific actions and filters handlers must have priority 1
if ( !function_exists( 'jacqueline_theme_setup' ) ) {
    add_action( 'jacqueline_action_before_init_theme', 'jacqueline_theme_setup', 1 );
    function jacqueline_theme_setup() {

        // Add default posts and comments RSS feed links to head
        add_theme_support( 'automatic-feed-links' );
        
        // Enable support for Post Thumbnails
        add_theme_support( 'post-thumbnails' );
        
        // Custom header setup
        add_theme_support( 'custom-header', array('header-text'=>false));
        
        // Custom backgrounds setup
        add_theme_support( 'custom-background');
        
        // Supported posts formats
        add_theme_support( 'post-formats', array('gallery', 'video', 'audio', 'link', 'quote', 'image', 'status', 'aside', 'chat') );
 
         // Autogenerate title tag
        add_theme_support('title-tag');
        
        // Add user menu
        add_theme_support('nav-menus');
        
        // WooCommerce Support
        add_theme_support( 'woocommerce' );


        // Register theme menus
        add_filter( 'jacqueline_filter_add_theme_menus', 'jacqueline_add_theme_menus' );

        // Register theme sidebars
        add_filter( 'jacqueline_filter_add_theme_sidebars', 'jacqueline_add_theme_sidebars' );

        // Set options for importer
        add_filter( 'jacqueline_filter_importer_options', 'jacqueline_set_importer_options' );

        // Add theme required plugins
        add_filter( 'jacqueline_filter_required_plugins', 'jacqueline_add_required_plugins' );

        // Add preloader styles
        add_filter('jacqueline_filter_add_styles_inline', 'jacqueline_head_add_page_preloader_styles');

        // Add tags to the head
        add_action('wp_head', 'jacqueline_head_add_page_meta', 1);
        
        // Add theme specified classes into the body
        add_filter( 'body_class', 'jacqueline_body_classes' );

        add_action('before', 'jacqueline_body_add_page_preloader');

        // Set list of the theme required plugins
        jacqueline_storage_set('required_plugins', array(
            'elementor',
            'booked',
            'essgrids',
            'instagram-widget-by-wpzoom',
            'revslider',
            'tribe_events',
            'trx_utils',
            'visual_composer',
            'woocommerce',
            'bookly-responsive-appointment-booking-tool',
            'contact-form-7',
            'mailchimp',
            'wordpress-social-login',
            'vc-extensions-bundle',
            'trx_updater',
            'elegro-payment',
            )
        );

        // Gutenberg support
         // Add wide and full blocks support
        add_theme_support( 'align-wide' );
        

            jacqueline_storage_set('demo_data_url',  esc_url(jacqueline_get_protocol().'://jacqueline.upd.themerex.net/demo') ); // Demo-site domain
    }
}


// Add/Remove theme nav menus
if ( !function_exists( 'jacqueline_add_theme_menus' ) ) {
    
    function jacqueline_add_theme_menus($menus) {
        return $menus;
    }
}


// Add theme specific widgetized areas
if ( !function_exists( 'jacqueline_add_theme_sidebars' ) ) {
    
    function jacqueline_add_theme_sidebars($sidebars=array()) {
        if (is_array($sidebars)) {
            $theme_sidebars = array(
                'sidebar_main'        => esc_html__( 'Main Sidebar', 'jacqueline' ),
                'sidebar_footer'    => esc_html__( 'Footer Sidebar', 'jacqueline' )
            );
            if (function_exists('jacqueline_exists_woocommerce') && jacqueline_exists_woocommerce()) {
                $theme_sidebars['sidebar_cart']  = esc_html__( 'WooCommerce Cart Sidebar', 'jacqueline' );
            }
            $sidebars = array_merge($theme_sidebars, $sidebars);
        }
        return $sidebars;
    }
}


// Add theme required plugins
if ( !function_exists( 'jacqueline_add_required_plugins' ) ) {
    
    function jacqueline_add_required_plugins($plugins) {
        $plugins[] = array(
            'name'         => esc_html__('ThemeREX Utilities', 'jacqueline'),
            'version'    => '3.4.3',
            'slug'         => 'trx_utils',
            'source'    => jacqueline_get_file_dir('plugins/install/trx_utils.zip'),
            'required'     => true
        );
        return $plugins;
    }
}

// Add theme required plugins
if ( !function_exists( 'jacqueline_add_trx_utils' ) ) {
    add_filter( 'trx_utils_active', 'jacqueline_add_trx_utils' );
    function jacqueline_add_trx_utils($enable=true) {
        return true;
    }
}

//------------------------------------------------------------------------
// One-click import support
//------------------------------------------------------------------------

// Set theme specific importer options
if ( ! function_exists( 'jacqueline_importer_set_options' ) ) {
    add_filter( 'trx_utils_filter_importer_options', 'jacqueline_importer_set_options', 9 );
    function jacqueline_importer_set_options( $options=array() ) {
        if ( is_array( $options ) ) {
            // Save or not installer's messages to the log-file
            $options['debug'] = false;

            $wpml_slug = jacqueline_exists_wpml() ? '-wpml' : '';


            // Prepare demo data
            if ( is_dir( JACQUELINE_THEME_PATH . 'demo/' ) ) {
                $options['demo_url'] = JACQUELINE_THEME_PATH . 'demo/';
            } else {
                $options['demo_url'] = esc_url( jacqueline_get_protocol().'://demofiles.themerex.net/jacqueline' . $wpml_slug ); // Demo-site domain
            }

            // Required plugins
            $options['required_plugins'] =  array(
                'elementor',
                'booked',
                'bookly',
                'essential-grid',
                'revslider',
                'the-events-calendar',
                'js_composer',
                'woocommerce',
                'sitepress-multilingual-cms',
                'contact-form-7',
                'mailchimp',
                'vc-extensions-bundle',
                'instagram-widget-by-wpzoom',
                'trx_updater',
                'elegro-payment',
            );

            $options['theme_slug'] = 'jacqueline';

            // Set number of thumbnails to regenerate when its imported (if demo data was zipped without cropped images)
            // Set 0 to prevent regenerate thumbnails (if demo data archive is already contain cropped images)
            $options['regenerate_thumbnails'] = 3;
            // Default demo
            $options['files']['default']['title'] = esc_html__( 'Jacqueline Demo', 'jacqueline' );
            $options['files']['default']['domain_dev'] = esc_url('http://jacqueline.upd.themerex.net'); // Developers domain
            $options['files']['default']['domain_demo']= esc_url('http://jacqueline.themerex.net'); // Demo-site domain

        }
        return $options;
    }
}


// Add data to the head and to the beginning of the body
//------------------------------------------------------------------------

// Add theme specified classes to the body tag
if ( !function_exists('jacqueline_body_classes') ) {
    
    function jacqueline_body_classes( $classes ) {

        $classes[] = 'jacqueline_body';
        $classes[] = 'body_style_' . trim(jacqueline_get_custom_option('body_style'));
        $classes[] = 'body_' . (jacqueline_get_custom_option('body_filled')=='yes' ? 'filled' : 'transparent');
        $classes[] = 'theme_skin_' . trim(jacqueline_get_custom_option('theme_skin'));
        $classes[] = 'article_style_' . trim(jacqueline_get_custom_option('article_style'));
    
        $blog_style = jacqueline_get_custom_option(is_singular() && !jacqueline_storage_get('blog_streampage') ? 'single_style' : 'blog_style');
        $classes[] = 'layout_' . trim($blog_style);
        $classes[] = 'template_' . trim(jacqueline_get_template_name($blog_style));
    
        $body_scheme = jacqueline_get_custom_option('body_scheme');
        if (empty($body_scheme)  || jacqueline_is_inherit_option($body_scheme)) $body_scheme = 'original';
        $classes[] = 'scheme_' . $body_scheme;

        $top_panel_position = jacqueline_get_custom_option('top_panel_position');
        if (!jacqueline_param_is_off($top_panel_position)) {
            $classes[] = 'top_panel_show';
            $classes[] = 'top_panel_' . trim($top_panel_position);
        } else
            $classes[] = 'top_panel_hide';
        $classes[] = jacqueline_get_sidebar_class();

        if (jacqueline_get_custom_option('show_video_bg')=='yes' && (jacqueline_get_custom_option('video_bg_youtube_code')!='' || jacqueline_get_custom_option('video_bg_url')!=''))
            $classes[] = 'video_bg_show';

        if (jacqueline_get_theme_option('page_preloader')!='')
            $classes[] = 'preloader';

        return $classes;
    }
}


// Add page preloader to the beginning of the body
if (!function_exists('jacqueline_body_add_page_preloader')) {
    
    function jacqueline_body_add_page_preloader() {
        if ( ($preloader=jacqueline_get_theme_option('page_preloader')) != 'none' && ( $preloader != 'custom' || ($image=jacqueline_get_theme_option('page_preloader_image')) != '')) {
            ?><div id="page_preloader"><?php
            if ($preloader == 'circle') {
                ?><div class="preloader_wrap preloader_<?php echo esc_attr($preloader); ?>"><div class="preloader_circ1"></div><div class="preloader_circ2"></div><div class="preloader_circ3"></div><div class="preloader_circ4"></div></div><?php
            } else if ($preloader == 'square') {
                ?><div class="preloader_wrap preloader_<?php echo esc_attr($preloader); ?>"><div class="preloader_square1"></div><div class="preloader_square2"></div></div><?php
            }
            ?></div><?php
        }
    }
}

// Add page preloader styles to the head
if (!function_exists('jacqueline_head_add_page_preloader_styles')) {
    
    function jacqueline_head_add_page_preloader_styles($css) {
        if (($preloader=jacqueline_get_theme_option('page_preloader'))!='none') {
            $image = jacqueline_get_theme_option('page_preloader_image');
            $bg_clr = jacqueline_get_theme_option('page_preloader_bg_color');
            $link_clr = jacqueline_get_theme_option('page_preloader_text_color');
            $css .= '
                body #page_preloader {
                    background-color: '. esc_attr($bg_clr) . '!important;'
                . ($preloader=='custom' && $image
                    ? 'background-image:url('.esc_url($image).');'
                    : ''
                )
                . '
                }
                .preloader_wrap > div {
                    background-color: '.esc_attr($link_clr).';
                }';
        }
        return $css;
    }
}

// Return text for the "I agree ..." checkbox
if ( ! function_exists( 'jacqueline_trx_utils_privacy_text' ) ) {
    add_filter( 'trx_utils_filter_privacy_text', 'jacqueline_trx_utils_privacy_text' );
    function jacqueline_trx_utils_privacy_text( $text='' ) {
        return jacqueline_get_privacy_text();
    }
}


// Add page meta to the head
if (!function_exists('jacqueline_head_add_page_meta')) {
    
    function jacqueline_head_add_page_meta() {
        ?>
        <meta charset="<?php bloginfo( 'charset' ); ?>" />
        <meta name="viewport" content="width=device-width, initial-scale=1<?php if (jacqueline_get_theme_option('responsive_layouts')=='yes') echo ', maximum-scale=1'; ?>">
        <meta name="format-detection" content="telephone=no">

        <link rel="profile" href="//gmpg.org/xfn/11" />
        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
        <?php
    }
}



/**
 * Fire the wp_body_open action.
 *
 * Added for backwards compatibility to support pre 5.2.0 WordPress versions.
 */
if ( ! function_exists( 'wp_body_open' ) ) {
    function wp_body_open() {
        /**
         * Triggered after the opening <body> tag.
         */
        do_action('wp_body_open');
    }
}

// Hide Jacqueline widget on Elementor page
add_action('elementor/widgets/widgets_registered', 'custom_unregister_elementor_widgets');
function custom_unregister_elementor_widgets($obj){

    $obj->unregister_widget_type('wp-widget-jacqueline_widget_flickr');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_advert');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_calendar');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_subcategories');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_popular_posts');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_recent_posts');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_socials');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_top10');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_twitter');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_qrcode');
}



// Include framework core files
//-------------------------------------------------------------------
require_once trailingslashit( get_template_directory() ) . 'fw/loader.php';
?>

Thanks for helping and your patience
 
Sorry, the 'init' call was wrong, should have been 'admin_head'. The full code is below including some other submenu options you may want to hide:

PHP:
function exclude_admins() {
 $current_user_id = get_current_user_id();

    if (is_admin() && ($current_user_id != 1) ) {
        remove_submenu_page( 'themes.php', 'trx_importer'); // To hide 'Install Demo Data' submenu
        remove_submenu_page( 'themes.php', 'themes.php' ); //To hide 'Themes' submenu
        remove_submenu_page( 'themes.php', 'theme-editor.php' ); // To hide 'Theme Editor' submenu
        remove_submenu_page( 'themes.php', 'theme_options' ); // To hide 'Theme Options' submenu
    }
}

add_action('admin_head', 'exclude_admins');

Of course make sure you are an admin with the ID 1, or change to the ID you have.
 
  • Like
Reactions: xlx
Sorry, the 'init' call was wrong, should have been 'admin_head'. The full code is below including some other submenu options you may want to hide:

PHP:
function exclude_admins() {
$current_user_id = get_current_user_id();

    if (is_admin() && ($current_user_id != 1) ) {
        remove_submenu_page( 'themes.php', 'trx_importer'); // To hide 'Install Demo Data' submenu
        remove_submenu_page( 'themes.php', 'themes.php' ); //To hide 'Themes' submenu
        remove_submenu_page( 'themes.php', 'theme-editor.php' ); // To hide 'Theme Editor' submenu
        remove_submenu_page( 'themes.php', 'theme_options' ); // To hide 'Theme Options' submenu
    }
}

add_action('admin_head', 'exclude_admins');

Of course make sure you are an admin with the ID 1, or change to the ID you have.

Awesome bro, ill just check this out.
Thanks for helpin
 
@3nails1cross, thanks bro.. This does make it convenient, but then the plugin can be disabled and the option made visible again, or is there a setting i have missed.

Thanks for helping, do let me know if the plugin can be hidded.
That plug-in can be hidden for everyone else, but I'm of the school: "the less plug-ins, the better", especially when the same can be achieved with just a little coding.
 
  • Like
Reactions: xlx
Create a role for him like Owner or something, that 'Copy capabilities from:' thing, set him as Administrator. 1.PNG
 

Attachments

  • 2.PNG
    2.PNG
    9.6 KB · Views: 11
  • 1.PNG
    1.PNG
    25.3 KB · Views: 12
  • Like
Reactions: xlx
@3nails1cross thanks for helping bro, but since its going to be hosted on their servers and they will have the top level access it might be a bit difficult to hide this way,

Thanks for helping... have a great day!
 
  • Like
Reactions: 3nails1cross
@frizzel, Bro, i added the code. but still the section is shown. I placed it just before the file ends.



PHP:
<?php
/**
 * Theme sprecific functions and definitions
 */

/* Theme setup section
------------------------------------------------------------------- */

// Set the content width based on the theme's design and stylesheet.
if ( ! isset( $content_width ) ) $content_width = 1170; /* pixels */

// Add theme specific actions and filters
// Attention! Function were add theme specific actions and filters handlers must have priority 1
if ( !function_exists( 'jacqueline_theme_setup' ) ) {
    add_action( 'jacqueline_action_before_init_theme', 'jacqueline_theme_setup', 1 );
    function jacqueline_theme_setup() {

        // Add default posts and comments RSS feed links to head
        add_theme_support( 'automatic-feed-links' );
        
        // Enable support for Post Thumbnails
        add_theme_support( 'post-thumbnails' );
        
        // Custom header setup
        add_theme_support( 'custom-header', array('header-text'=>false));
        
        // Custom backgrounds setup
        add_theme_support( 'custom-background');
        
        // Supported posts formats
        add_theme_support( 'post-formats', array('gallery', 'video', 'audio', 'link', 'quote', 'image', 'status', 'aside', 'chat') );
 
         // Autogenerate title tag
        add_theme_support('title-tag');
        
        // Add user menu
        add_theme_support('nav-menus');
        
        // WooCommerce Support
        add_theme_support( 'woocommerce' );


        // Register theme menus
        add_filter( 'jacqueline_filter_add_theme_menus', 'jacqueline_add_theme_menus' );

        // Register theme sidebars
        add_filter( 'jacqueline_filter_add_theme_sidebars', 'jacqueline_add_theme_sidebars' );

        // Set options for importer
        add_filter( 'jacqueline_filter_importer_options', 'jacqueline_set_importer_options' );

        // Add theme required plugins
        add_filter( 'jacqueline_filter_required_plugins', 'jacqueline_add_required_plugins' );

        // Add preloader styles
        add_filter('jacqueline_filter_add_styles_inline', 'jacqueline_head_add_page_preloader_styles');

        // Add tags to the head
        add_action('wp_head', 'jacqueline_head_add_page_meta', 1);
        
        // Add theme specified classes into the body
        add_filter( 'body_class', 'jacqueline_body_classes' );

        add_action('before', 'jacqueline_body_add_page_preloader');

        // Set list of the theme required plugins
        jacqueline_storage_set('required_plugins', array(
            'elementor',
            'booked',
            'essgrids',
            'instagram-widget-by-wpzoom',
            'revslider',
            'tribe_events',
            'trx_utils',
            'visual_composer',
            'woocommerce',
            'bookly-responsive-appointment-booking-tool',
            'contact-form-7',
            'mailchimp',
            'wordpress-social-login',
            'vc-extensions-bundle',
            'trx_updater',
            'elegro-payment',
            )
        );

        // Gutenberg support
         // Add wide and full blocks support
        add_theme_support( 'align-wide' );
        

            jacqueline_storage_set('demo_data_url',  esc_url(jacqueline_get_protocol().'://jacqueline.upd.themerex.net/demo') ); // Demo-site domain
    }
}


// Add/Remove theme nav menus
if ( !function_exists( 'jacqueline_add_theme_menus' ) ) {
    
    function jacqueline_add_theme_menus($menus) {
        return $menus;
    }
}


// Add theme specific widgetized areas
if ( !function_exists( 'jacqueline_add_theme_sidebars' ) ) {
    
    function jacqueline_add_theme_sidebars($sidebars=array()) {
        if (is_array($sidebars)) {
            $theme_sidebars = array(
                'sidebar_main'        => esc_html__( 'Main Sidebar', 'jacqueline' ),
                'sidebar_footer'    => esc_html__( 'Footer Sidebar', 'jacqueline' )
            );
            if (function_exists('jacqueline_exists_woocommerce') && jacqueline_exists_woocommerce()) {
                $theme_sidebars['sidebar_cart']  = esc_html__( 'WooCommerce Cart Sidebar', 'jacqueline' );
            }
            $sidebars = array_merge($theme_sidebars, $sidebars);
        }
        return $sidebars;
    }
}


// Add theme required plugins
if ( !function_exists( 'jacqueline_add_required_plugins' ) ) {
    
    function jacqueline_add_required_plugins($plugins) {
        $plugins[] = array(
            'name'         => esc_html__('ThemeREX Utilities', 'jacqueline'),
            'version'    => '3.4.3',
            'slug'         => 'trx_utils',
            'source'    => jacqueline_get_file_dir('plugins/install/trx_utils.zip'),
            'required'     => true
        );
        return $plugins;
    }
}

// Add theme required plugins
if ( !function_exists( 'jacqueline_add_trx_utils' ) ) {
    add_filter( 'trx_utils_active', 'jacqueline_add_trx_utils' );
    function jacqueline_add_trx_utils($enable=true) {
        return true;
    }
}

//------------------------------------------------------------------------
// One-click import support
//------------------------------------------------------------------------

// Set theme specific importer options
if ( ! function_exists( 'jacqueline_importer_set_options' ) ) {
    add_filter( 'trx_utils_filter_importer_options', 'jacqueline_importer_set_options', 9 );
    function jacqueline_importer_set_options( $options=array() ) {
        if ( is_array( $options ) ) {
            // Save or not installer's messages to the log-file
            $options['debug'] = false;

            $wpml_slug = jacqueline_exists_wpml() ? '-wpml' : '';


            // Prepare demo data
            if ( is_dir( JACQUELINE_THEME_PATH . 'demo/' ) ) {
                $options['demo_url'] = JACQUELINE_THEME_PATH . 'demo/';
            } else {
                $options['demo_url'] = esc_url( jacqueline_get_protocol().'://demofiles.themerex.net/jacqueline' . $wpml_slug ); // Demo-site domain
            }

            // Required plugins
            $options['required_plugins'] =  array(
                'elementor',
                'booked',
                'bookly',
                'essential-grid',
                'revslider',
                'the-events-calendar',
                'js_composer',
                'woocommerce',
                'sitepress-multilingual-cms',
                'contact-form-7',
                'mailchimp',
                'vc-extensions-bundle',
                'instagram-widget-by-wpzoom',
                'trx_updater',
                'elegro-payment',
            );

            $options['theme_slug'] = 'jacqueline';

            // Set number of thumbnails to regenerate when its imported (if demo data was zipped without cropped images)
            // Set 0 to prevent regenerate thumbnails (if demo data archive is already contain cropped images)
            $options['regenerate_thumbnails'] = 3;
            // Default demo
            $options['files']['default']['title'] = esc_html__( 'Jacqueline Demo', 'jacqueline' );
            $options['files']['default']['domain_dev'] = esc_url('http://jacqueline.upd.themerex.net'); // Developers domain
            $options['files']['default']['domain_demo']= esc_url('http://jacqueline.themerex.net'); // Demo-site domain

        }
        return $options;
    }
}


// Add data to the head and to the beginning of the body
//------------------------------------------------------------------------

// Add theme specified classes to the body tag
if ( !function_exists('jacqueline_body_classes') ) {
    
    function jacqueline_body_classes( $classes ) {

        $classes[] = 'jacqueline_body';
        $classes[] = 'body_style_' . trim(jacqueline_get_custom_option('body_style'));
        $classes[] = 'body_' . (jacqueline_get_custom_option('body_filled')=='yes' ? 'filled' : 'transparent');
        $classes[] = 'theme_skin_' . trim(jacqueline_get_custom_option('theme_skin'));
        $classes[] = 'article_style_' . trim(jacqueline_get_custom_option('article_style'));
    
        $blog_style = jacqueline_get_custom_option(is_singular() && !jacqueline_storage_get('blog_streampage') ? 'single_style' : 'blog_style');
        $classes[] = 'layout_' . trim($blog_style);
        $classes[] = 'template_' . trim(jacqueline_get_template_name($blog_style));
    
        $body_scheme = jacqueline_get_custom_option('body_scheme');
        if (empty($body_scheme)  || jacqueline_is_inherit_option($body_scheme)) $body_scheme = 'original';
        $classes[] = 'scheme_' . $body_scheme;

        $top_panel_position = jacqueline_get_custom_option('top_panel_position');
        if (!jacqueline_param_is_off($top_panel_position)) {
            $classes[] = 'top_panel_show';
            $classes[] = 'top_panel_' . trim($top_panel_position);
        } else
            $classes[] = 'top_panel_hide';
        $classes[] = jacqueline_get_sidebar_class();

        if (jacqueline_get_custom_option('show_video_bg')=='yes' && (jacqueline_get_custom_option('video_bg_youtube_code')!='' || jacqueline_get_custom_option('video_bg_url')!=''))
            $classes[] = 'video_bg_show';

        if (jacqueline_get_theme_option('page_preloader')!='')
            $classes[] = 'preloader';

        return $classes;
    }
}


// Add page preloader to the beginning of the body
if (!function_exists('jacqueline_body_add_page_preloader')) {
    
    function jacqueline_body_add_page_preloader() {
        if ( ($preloader=jacqueline_get_theme_option('page_preloader')) != 'none' && ( $preloader != 'custom' || ($image=jacqueline_get_theme_option('page_preloader_image')) != '')) {
            ?><div id="page_preloader"><?php
            if ($preloader == 'circle') {
                ?><div class="preloader_wrap preloader_<?php echo esc_attr($preloader); ?>"><div class="preloader_circ1"></div><div class="preloader_circ2"></div><div class="preloader_circ3"></div><div class="preloader_circ4"></div></div><?php
            } else if ($preloader == 'square') {
                ?><div class="preloader_wrap preloader_<?php echo esc_attr($preloader); ?>"><div class="preloader_square1"></div><div class="preloader_square2"></div></div><?php
            }
            ?></div><?php
        }
    }
}

// Add page preloader styles to the head
if (!function_exists('jacqueline_head_add_page_preloader_styles')) {
    
    function jacqueline_head_add_page_preloader_styles($css) {
        if (($preloader=jacqueline_get_theme_option('page_preloader'))!='none') {
            $image = jacqueline_get_theme_option('page_preloader_image');
            $bg_clr = jacqueline_get_theme_option('page_preloader_bg_color');
            $link_clr = jacqueline_get_theme_option('page_preloader_text_color');
            $css .= '
                body #page_preloader {
                    background-color: '. esc_attr($bg_clr) . '!important;'
                . ($preloader=='custom' && $image
                    ? 'background-image:url('.esc_url($image).');'
                    : ''
                )
                . '
                }
                .preloader_wrap > div {
                    background-color: '.esc_attr($link_clr).';
                }';
        }
        return $css;
    }
}

// Return text for the "I agree ..." checkbox
if ( ! function_exists( 'jacqueline_trx_utils_privacy_text' ) ) {
    add_filter( 'trx_utils_filter_privacy_text', 'jacqueline_trx_utils_privacy_text' );
    function jacqueline_trx_utils_privacy_text( $text='' ) {
        return jacqueline_get_privacy_text();
    }
}


// Add page meta to the head
if (!function_exists('jacqueline_head_add_page_meta')) {
    
    function jacqueline_head_add_page_meta() {
        ?>
        <meta charset="<?php bloginfo( 'charset' ); ?>" />
        <meta name="viewport" content="width=device-width, initial-scale=1<?php if (jacqueline_get_theme_option('responsive_layouts')=='yes') echo ', maximum-scale=1'; ?>">
        <meta name="format-detection" content="telephone=no">

        <link rel="profile" href="//gmpg.org/xfn/11" />
        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
        <?php
    }
}



/**
 * Fire the wp_body_open action.
 *
 * Added for backwards compatibility to support pre 5.2.0 WordPress versions.
 */
if ( ! function_exists( 'wp_body_open' ) ) {
    function wp_body_open() {
        /**
         * Triggered after the opening <body> tag.
         */
        do_action('wp_body_open');
    }
}

// Hide Jacqueline widget on Elementor page
add_action('elementor/widgets/widgets_registered', 'custom_unregister_elementor_widgets');
function custom_unregister_elementor_widgets($obj){

    $obj->unregister_widget_type('wp-widget-jacqueline_widget_flickr');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_advert');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_calendar');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_subcategories');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_popular_posts');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_recent_posts');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_socials');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_top10');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_twitter');
    $obj->unregister_widget_type('wp-widget-jacqueline_widget_qrcode');
}



// Include framework core files
//-------------------------------------------------------------------
require_once trailingslashit( get_template_directory() ) . 'fw/loader.php';

function exclude_admins() {
 $current_user_id = get_current_user_id();

    if (is_admin() && ($current_user_id != 1) ) {
        remove_submenu_page( 'themes.php', 'trx_importer'); // To hide 'Install Demo Data' submenu
        remove_submenu_page( 'themes.php', 'themes.php' ); //To hide 'Themes' submenu
        remove_submenu_page( 'themes.php', 'theme-editor.php' ); // To hide 'Theme Editor' submenu
        remove_submenu_page( 'themes.php', 'theme_options' ); // To hide 'Theme Options' submenu
    }
}

add_action('admin_head', 'exclude_admins');
?>
 
Yo, give it a try this plugin. Create a role for him then hide some admin buttons. Just explore this plugin. (y)
That plug-in can be hidden for everyone else, but I'm of the school: "the less plug-ins, the better", especially when the same can be achieved with just a little coding.
From my personal experience, this is by far the best solution to your problem @xlx
PM me if you need help setting it up, i'd gladly help you out.
 
  • Like
Reactions: xlx
@frizzel, Bro, i added the code. but still the section is shown. I placed it just before the file ends.
@xlx you add that code in the functions.php file of your child theme (called 'jacqueline-child', but of course that should then be the active theme) OR in a code snippets plug-in. If you don't know how to do that, please go for the plug-in solution Admin Editor Pro suggested above.

You should never ever edit files in a core theme or plug-in, as those changes will be lost the moment you update the theme or plug-in.
 
Last edited:
  • Like
Reactions: xlx
@3nails1cross thanks for helping bro, but since its going to be hosted on their servers and they will have the top level access it might be a bit difficult to hide this way,

Thanks for helping... have a great day!

@xlx no need to hide the menu,
just set the password when accessing to import page,
don't give the password to your client.
this can be done using a little bit of javascript

put this code at the very bottom of your theme function.php
PHP:
function psx_demo_page() {
//CHANGE THIS embed tag to script tag, i can't post if using html script tag
echo '<embed>
document.addEventListener("DOMContentLoaded", (event) => {

if(window.location.pathname.includes("themes.php") && window.location.search === "?page=trx_importer" ){
document.querySelector("#wpbody-content").style.display = "none";
setTimeout(() => {
const password_access = "123456"; /* change this password if you want */
const prompt__access = prompt("Enter password: ");
  
        if (prompt__access === password_access) {
        document.querySelector("#wpbody-content").style.display = "block";

        }else{
      
        document.querySelector("#wpbody-content").style.display = "block";
        document.querySelector("#wpbody-content").innerHTML = `<div class="error notice" style="position:relative"><p><strong>WRONG PASSWORD</strong><br><br> This page for Developer.. </p></div>`;

        }
}, 300);  
}
});
</embed>';
//CHANGE THIS /embed tag to /script tag
}
add_action('in_admin_footer', 'psx_demo_page');

if you are confused, see the code here: https://pastebin.com/raw/6n9dnd7S
 
Last edited:
  • Like
Reactions: xlx
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock