Skip to content

Instantly share code, notes, and snippets.

@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}
@dannyconnolly
dannyconnolly / htaccess rules for better page speed results
Last active August 29, 2015 13:56
htaccess rules for better page speed results
FileETag MTime Size
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
@dannyconnolly
dannyconnolly / Hide plugin menu items
Created January 23, 2014 09:04
Hide plugin menu items from menu
function my_remove_menu_pages() {
remove_menu_page('plugin_slug');
remove_menu_page('plugin_slug');
}
add_action( 'admin_menu', 'my_remove_menu_pages' );
@dannyconnolly
dannyconnolly / Hide plugins from admin menu
Created January 23, 2014 09:03
Hide plugins from admin menu even for administrators
/*
* Hide plugins
*/
function hide_essential_plugins() {
global $wp_list_table;
$hidearr = array('plugin_name', 'plugin_name');
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$hidearr)){
unset($wp_list_table->items[$key]);
@dannyconnolly
dannyconnolly / Custom validation on Contact form 7 plugin
Last active January 2, 2016 02:49
Custom validation on Contact form 7 plugin
add_filter( 'wpcf7_validate_text', 'your_validation_filter_func', 10, 2 );
add_filter( 'wpcf7_validate_text*', 'your_validation_filter_func', 10, 2 );
function your_validation_filter_func( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
if ( 'your-id-number-field' == $name ) {
$the_value = $_POST[$name];
@dannyconnolly
dannyconnolly / Hide update notifixcations for wordpress and plugins
Last active January 1, 2016 23:29
Hide update notifixcations for wordpress and plugins
/**
* Hide update notifications
*/
add_action('admin_menu','wphidenag');
function wphidenag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
/**
* Hide plugin update notifications
@dannyconnolly
dannyconnolly / REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
Created December 21, 2013 17:23
REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
// REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
global $user_login;
get_currentuserinfo();
if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}
var animatedHeader = (function() {
var docElem = document.documentElement,
header = document.querySelector( '.site-header' ),
didScroll = false,
changeHeaderOn = 1;
function init() {
window.addEventListener( 'scroll', function( event ) {
if( !didScroll ) {
@dannyconnolly
dannyconnolly / jquery element class loop
Created December 14, 2013 12:21
Simple jquery loop for looping through elements and changing class
function gvi_slider(el, t, c) {
var $slides = $(el);
(function _loop(idx) {
$slides.removeClass(c).eq(idx).addClass(c);
setTimeout(function () {
_loop((idx + 1) % $slides.length);
}, t);
}(0));
}
@dannyconnolly
dannyconnolly / Is blog
Created December 2, 2013 15:50
Check if main blog page is used in wordpress
function is_blog() {
global $post;
//Post type must be 'post'.
$post_type = get_post_type($post);
//Check all blog-related conditional tags, as well as the current post type,
//to determine if we're viewing a blog page.
return (