Benutzer-Werkzeuge

Webseiten-Werkzeuge


Seitenleiste

3D

INTERN

ADOBE

ARDUINO

BITBUCKET

DOCKER

C4D

GIT

HTML

IPHONE

JAVASCRIPT

JTL-SHOP

LARAVEL

MAGENTO2

MYSQL

PHP

PLESK

PROCESSING

PYTHON

SUITECRM

SEO

TRYTON

THUNDERBIRD / ICEDOVE / FossaMail

TYPO3

TYPO3: BACKEND

TYPO3: TYPOSCRIPT

UNIX

VLC

VVVV

WINDOWS

WINDOWS 10

WORDPRESS

XAMPP

XT:C 4 (Veyton)

wordpress:clenup-admin-for-clients

Wordpress: Cleanup Admin for Clients

place folling as file in the theme and require it in your themes function.php

<?php
/*
 * Following functions coming from
 * https://www.smashingmagazine.com/2016/07/how-to-make-wordpress-hard-for-clients-to-mess-up/
 * i renamed the functions to deglowdesign_ namespace to be easily identified by me in my codebase
 * but all credit goes to the aformentioned author and site
 */
 
// place this in wp-config.php to disable wordpress file editing in the backend
//define( 'DISALLOW_FILE_EDIT', true );
 
function deglowdesign_disable_visual_editor() {
	# add logic here if you want to permit it selectively
	return false;
}
 
//add_filter( 'user_can_richedit', 'deglowdesign_disable_visual_editor', 50 );
 
 
# Remove visual editor buttons
function deglowdesign_tinymce_buttons( $buttons ) {
	# Remove the text color selector
	$remove = array( 'wp_adv', 'wp_more' ); //Add other button names to this array
	# Find the array key and then unset
	return array_diff( $buttons, $remove );
}
 
add_filter( 'mce_buttons', 'deglowdesign_tinymce_buttons' );
 
 
# Remove media buttons
function deglowdesign_remove_add_media() {
	# do this conditionally if you want to be more selective
	remove_action( 'media_buttons', 'media_buttons' );
}
 
add_action( 'admin_head', 'deglowdesign_remove_add_media' );
 
//global $Piklist_Shortcode;
remove_action( 'media_buttons', array( 'piklist_shortcode', 'media_buttons' ), 100 );
 
 
# Remove customizer options.
function deglowdesign_remove_customizer_options( $wp_customize ) {
	// $wp_customize->remove_section( 'static_front_page' );
	// $wp_customize->remove_section( 'title_tagline' );
	$wp_customize->remove_section( 'colors' );
	$wp_customize->remove_section( 'header_image' );
	$wp_customize->remove_section( 'background_image' );
	// $wp_customize->remove_section( 'nav' );
	$wp_customize->remove_section( 'themes' );
	$wp_customize->remove_section( 'featured_content' );
	$wp_customize->remove_panel( 'widgets' );
}
 
add_action( 'customize_register', 'deglowdesign_remove_customizer_options', 30 );
 
 
function deglowdesign_custom_menu_page_removing() {
	// remove_menu_page( 'index.php' );                  //Dashboard
	// remove_menu_page( 'jetpack' );                    //Jetpack*
	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', 'deglowdesign_custom_menu_page_removing' );
 
 
# Adds instruction text after the post title input
function deglowdesign_edit_form_after_title() {
	$tip = '<strong>TIP:</strong> Für einen einfachen Zeilenumbruch SHIFT+ENTER benutzen. Die ENTER Taste allein erzeugt immer einen neuen Absatz.';
	echo '<p style="margin-bottom:0;">' . $tip . '</p>';
}
 
add_action('edit_form_after_title','deglowdesign_edit_form_after_title');
 
 
function remove_editor_init() {
	// If not in the admin, return.
	if ( ! is_admin() ) {
		return;
	}
 
	// Get the post ID on edit post with filter_input super global inspection.
	$current_post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT );
	// Get the post ID on update post with filter_input super global inspection.
	$update_post_id = filter_input( INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT );
 
	// Check to see if the post ID is set, else return.
	if ( isset( $current_post_id ) ) {
		$post_id = absint( $current_post_id );
	} else if ( isset( $update_post_id ) ) {
		$post_id = absint( $update_post_id );
	} else {
		return;
	}
 
	// Don't do anything unless there is a post_id.
	if ( isset( $post_id ) ) {
		// Get the template of the current post.
		$template_file = get_post_meta( $post_id, '_wp_page_template', true );
 
		// Example of removing page editor for page-your-template.php template.
		if ( 'page-projects.php' === $template_file ) {
			remove_post_type_support( 'page', 'editor' );
			// Other features can also be removed in addition to the editor. See: https://codex.wordpress.org/Function_Reference/remove_post_type_support.
		}
	}
}
 
add_action( 'init', 'remove_editor_init' );
wordpress/clenup-admin-for-clients.txt · Zuletzt geändert: 2016/07/20 19:24 von admin