Skip to content

Instantly share code, notes, and snippets.

View matthacksteiner's full-sized avatar

Matthias Hacksteiner matthacksteiner

View GitHub Profile
@matthacksteiner
matthacksteiner / Hide add new Button
Last active December 15, 2015 03:39
Wordpress Hide "Page Add new Button" #wordpress #backend #functions.php
//hide Page
function hide_buttons()
{
global $current_screen;
if($current_screen->id == 'page');
{
echo '<style>.add-new-h2{display: none;}</style>';
}
@matthacksteiner
matthacksteiner / Meta Boxes
Created March 19, 2013 14:28
Hide Meta Boxes for non-admin #wordpress #backend #functions.php
// Hide Admin Meta Boxes
add_action( 'admin_menu', 'remove_meta_boxes' );
function remove_meta_boxes() {
// remove_meta_box( 'submitdiv', 'post', 'normal' ); // Publish meta box
remove_meta_box( 'commentsdiv', 'post', 'normal' ); // Comments meta box
remove_meta_box( 'revisionsdiv', 'post', 'normal' ); // Revisions meta box
remove_meta_box( 'authordiv', 'post', 'normal' ); // Author meta box
remove_meta_box( 'slugdiv', 'post', 'normal' ); // Slug meta box
remove_meta_box( 'tagsdiv-post_tag', 'post', 'side' ); // Post tags meta box
// remove_meta_box( 'categorydiv', 'post', 'side' ); // Category meta box
@matthacksteiner
matthacksteiner / TinyMCE Configurator
Last active December 15, 2015 03:48
TinyMCE Configurator #wordpress #functions.php #backend
/**
* TinyMCE conf
*/
function SissibayTinyMCE($in)
{
$in['remove_linebreaks']=false;
$in['gecko_spellcheck']=false;
$in['keep_styles']=false;
$in['accessibility_focus']=false;
@matthacksteiner
matthacksteiner / Asset.php
Last active December 15, 2015 23:49
Hide Admin Bar #wordpress #functions.php
/*Hide Wordpress Admin bar */
add_filter('show_admin_bar', '__return_false');
@matthacksteiner
matthacksteiner / Asset.scpt
Last active December 16, 2015 15:59
Mount Drives #applescript
tell application "Path Finder"
open location "smb://user:pass@server/folder"
end tell
tell application "Finder"
open location "smb://user:pass@server/folder"
end tell
@matthacksteiner
matthacksteiner / Asset.scpt
Created April 25, 2013 13:48
Start Time Machine Backup now #applescript
do shell script "/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper & "
@matthacksteiner
matthacksteiner / Asset.scpt
Last active December 16, 2015 15:59
Go to sleep #applescript
set sleepTime to 0
set theText to text returned of (display dialog "Ruhezustand aktivieren in:" default answer "1 h 30 m")
set defaults to AppleScript's text item delimiters
set AppleScript's text item delimiters to " " -- use " " as delimiters
set theWords to text items of theText
set timesToRun to (number of theWords) / 2
set n to 0 -- index
@matthacksteiner
matthacksteiner / clip.php
Created April 21, 2015 13:35
Hide add new Button
//hide Page Seite
function hide_buttons()
{
global $current_screen;
if($current_screen->id == 'page');
{
echo '<style>.add-new-h2{display: none;}</style>';
}
@matthacksteiner
matthacksteiner / clip.php
Created April 21, 2015 13:35
Hide Meta Boxes
// Hide Admin Meta Boxes
add_action( 'admin_menu', 'remove_meta_boxes' );
function remove_meta_boxes() {
// remove_meta_box( 'submitdiv', 'post', 'normal' ); // Publish meta box
remove_meta_box( 'commentsdiv', 'post', 'normal' ); // Comments meta box
remove_meta_box( 'revisionsdiv', 'post', 'normal' ); // Revisions meta box
remove_meta_box( 'authordiv', 'post', 'normal' ); // Author meta box
remove_meta_box( 'slugdiv', 'post', 'normal' ); // Slug meta box
remove_meta_box( 'tagsdiv-post_tag', 'post', 'side' ); // Post tags meta box
// remove_meta_box( 'categorydiv', 'post', 'side' ); // Category meta box
@matthacksteiner
matthacksteiner / clip.php
Created April 21, 2015 13:35
remove menus for non-admins
// remove menus for non-admins
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
if(!current_user_can('manage_options')) {
// Remove the "Tools" menu
remove_menu_page('tools.php');
remove_menu_page('edit-comments.php');
remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' );
remove_submenu_page( 'edit.php?post_type=page', 'post-new.php?post_type=page' );