Last active
August 29, 2015 13:56
-
-
Save nfreear/9049532 to your computer and use it in GitHub Desktop.
Wordpress - My custom functions | http://wphidedash.org/2011/04/best-practice-for-adding-custom-functions/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: My Custom Functions | |
Plugin URI: https://gist.github.com/nfreear/9049532 | |
Description: A simple plugin that contains all the awesome little functions that | |
I use to make my site work <a href="http://wphidedash.org/2011/04/best-practice | |
-for-adding-custom-functions/">my way.</a> | |
Author: Nick Freear | |
Author URI: https://github.com/IET-OU/oer-evidence-hub-org/#Juxtalearn | |
Version: 0.1 | |
*/ | |
// FILE: juxtalearn_hub/wordpress/wp-content/plugins/my-custom-functions.php | |
// http://wphidedash.org/2011/04/best-practice-for-adding-custom-functions/ | |
// http://wpmututorials.com/basics/what-is-the-mu-plugins-folder/ | |
/* Disallow direct access to the plugin file */ | |
if (basename($_SERVER['PHP_SELF']) == basename (__FILE__)) { | |
die('Sorry, but you cannot access this page directly.'); | |
} | |
/** START ADDING CODE BELOW THIS LINE **/ | |
//http://wordpress.org/support/topic/stop-wordpress-from-adding-p-tags-and-removing-line-break | |
//remove_filter ('the_content', 'wpautop'); | |
//http://wordpress.stackexchange.com/questions/66834/how-to-target-with-css-admin-elements-according-to-user-role-level | |
function wpa66834_role_admin_body_class( $classes ) { | |
global $current_user; | |
foreach( $current_user->roles as $role ) | |
$classes .= ' role-' . $role; | |
return trim( $classes ); | |
} | |
add_filter( 'admin_body_class', 'wpa66834_role_admin_body_class' ); | |
/** STOP ADDING CODE NOW**/ | |
/* That's all folks! */ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment