Site icon Hip-Hop Website Design and Development

Add customized operate to a theme with baby theme’s capabilities.php

I’m utilizing a theme Indigo and have it working tremendous, in a toddler theme configuration. I wish to add a customized operate. Not like the kid fashion.css, I’ve learn that you simply needn’t import the dad or mum capabilities.php. Nevertheless after I add my very own operate to a clean file, capabilities.php within the baby theme folder, my web page does not load appropriately and I see textual content from the kid capabilities.php.

I’ve seen options on right here requiring that the dad or mum capabilities.php has capabilities that may be rewritten.

What are my choices right here? I would like my customizations, however I do not desire a theme replace to bork them.

That is what I am attempting to drop in…

/**
 * Disable admin bar on the frontend of your web site
 * for subscribers.
 */
operate themeblvd_disable_admin_bar() { 
    if( ! current_user_can('edit_posts') )
        add_filter('show_admin_bar', '__return_false'); 
}
add_action( 'after_setup_theme', 'themeblvd_disable_admin_bar' );

/**
 * Redirect again to homepage and never enable entry to 
 * WP admin for Subscribers.
 */
operate themeblvd_redirect_admin(){
    if ( ! current_user_can( 'edit_posts' ) ){
        wp_redirect( site_url() );
        exit;       
    }
}
add_action( 'admin_init', 'themeblvd_redirect_admin' );

It is alleged to disable the WP admin bar for low degree logins.

FYI I’ve examined them within the dad or mum capabilities.php