Add Script to WordPess Header

function my_custom_js() {
    echo '<script src="https://wchat.freshchat.com/js/widget.js"></script>';
}
// Add hook for admin <head></head>
add_action( 'admin_head', 'my_custom_js' );
// Add hook for front-end <head></head>
add_action( 'wp_head', 'my_custom_js' );

Remove Admin Menu Items

function remove_menus(){
  remove_menu_page( 'index.php' );                  //Dashboard
  remove_menu_page( 'edit.php' );                   //Posts
  remove_menu_page( 'upload.php' );                 //Media
  remove_menu_page( 'edit.php?post_type=page' );    //Pages
  remove_menu_page( 'edit-comments.php' );          //Comments
  remove_menu_page( 'themes.php' );                 //Appearance
  remove_menu_page( 'plugins.php' );                //Plugins
  remove_menu_page( 'users.php' );                  //Users
  remove_menu_page( 'tools.php' );                  //Tools
  remove_menu_page( 'options-general.php' );        //Settings 
}
add_action( 'admin_menu', 'remove_menus' );

Limit User Role to their own posts in WordPress Admin

WPBeginner

function posts_for_current_author($query) {
    global $pagenow;
 
    if( 'edit.php' != $pagenow || !$query->is_admin )
        return $query;
 
    if( !current_user_can( 'edit_others_posts' ) ) {
        global $user_ID;
        $query->set('author', $user_ID );
    }
    return $query;
}
add_filter('pre_get_posts', 'posts_for_current_author');

The post title says it all…
Note: If you cut down admin privileges for user roles as well you can use the admin section for front end posting. Just remember you need to include admin styles differently when its for the admin section. You need a script for the functions.php file.

WordPress Child Theme Code

  • Create these files first
    • functions.php
    • style.css
    • style-mobile.css
    • script.js
for functions.php
<?php
  function my_theme_enqueue_styles() {
    $parent_style = '../Divi';
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );

    wp_enqueue_style( 'child-styles', get_stylesheet_directory_uri() . '/style.css');
    wp_enqueue_style( 'child-style-mobile', get_stylesheet_directory_uri() . '/style-mobile.css');

    wp_enqueue_script('child-scripts', get_template_directory_uri() . '/script.js' );
  }
add_action("wp_enqueue_scripts","my_theme_enqueue_styles");
?>

for script.js

jQuery(document).ready(function( $ ) {
  console.log('Ready!');
}

for style.css

/*
Theme Name: Divi Child
Description: A dev site
Author: Garth Baker
Template: Divi
*/

for style-mobile.css

@media only screen and (max-width:600px) {
  /*--------------------------------*/
}