Skip to content

Instantly share code, notes, and snippets.

<?php
function check_user_role($roles,$user_id=NULL) {
// Get user by ID, else get current user
if ($user_id)
$user = get_userdata($user_id);
else
$user = wp_get_current_user();
// No user found, return
<?php
// Filter JPEG compression
add_filter('jpeg_quality', function($arg) { return 100; });
@wpbandit
wpbandit / remove-default-wordpress-widgets.php
Created December 15, 2012 23:42
Action and function to unregister default WordPress widgets.
<?php
// Add Action : Unregister default WordPress widgets
add_action('widgets_init', 'unregister_default_wp_widgets', 1);
// Unregister default WordPress widgets
function unregister_default_wp_widgets() {
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Categories');
@wpbandit
wpbandit / wp-move-admin-bar.php
Created March 2, 2012 15:47
WP Move Admin Bar
<?php
// Add action to wp_head
add_action('wp_head','move_admin_bar_bottom');
// Move admin bar to bottom of page
function move_admin_bar_bottom() {
if(is_user_logged_in()) {
echo "
@wpbandit
wpbandit / wp-javascript.php
Created February 20, 2012 01:28
WP Load JS
<?php
// Add action to enqueue scripts
add_action('wp_enqueue_scripts','theme_javascript');
// Function to load theme javascript
function theme_javascript() {
// Register slider script
@wpbandit
wpbandit / sample-js-static.html
Created February 20, 2012 01:12
WP Static JS
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js?ver=1.7.1"></script>
<script src="js/jquery.slider.js"></script>
<script src="js/theme.js"></script>