Benutzer-Werkzeuge

Webseiten-Werkzeuge


wordpress:clenup-admin-for-clients

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
wordpress:clenup-admin-for-clients [2016/07/20 19:07]
admin angelegt
wordpress:clenup-admin-for-clients [2016/07/20 19:24] (aktuell)
admin
Zeile 6: Zeile 6:
 <?php <?php
 /* /*
- * Following functions coming ​form suggestions ​from+ * Following functions coming from
  * https://​www.smashingmagazine.com/​2016/​07/​how-to-make-wordpress-hard-for-clients-to-mess-up/​  * 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
  */  */
  
Zeile 83: Zeile 85:
 } }
  
-add_action( +add_action('​edit_form_after_title','​deglowdesign_edit_form_after_title'​); 
- '​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' ​);
  
 </​code>​ </​code>​
wordpress/clenup-admin-for-clients.1469034456.txt.gz · Zuletzt geändert: 2016/07/20 19:07 von admin