Skip to content

Instantly share code, notes, and snippets.

View Cathrin-Demyokhina's full-sized avatar

Kate Demyokhina Cathrin-Demyokhina

View GitHub Profile
@Cathrin-Demyokhina
Cathrin-Demyokhina / functions.php
Created October 13, 2017 07:54
Remove query strings from static resources
//Paste into functions.php and do not forget to clear cache
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
@Cathrin-Demyokhina
Cathrin-Demyokhina / functions.php
Created October 13, 2017 07:40
WP disable top bar menu for all users except admin
//Paste this code in your theme’s functions.php file
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
@Cathrin-Demyokhina
Cathrin-Demyokhina / functions.php
Created October 13, 2017 07:36
Buddypress Remove admin from members list and all the activity
//add this to child-theme functions.php
//deny access to admins profile. User is redirected to the homepage
function bpfr_hide_admins_profile() {
global $bp;
if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
wp_redirect( home_url() );
exit;
endif;
}
@Cathrin-Demyokhina
Cathrin-Demyokhina / Sticky-nav.js
Last active October 28, 2016 08:39
Sticky menu for Genesis
jQuery(function( $ ) {
var starting_position = $('.site-header').outerHeight( true ) + $('.nav-primary').outerHeight( true );
$(window).scroll(function() {
var yPos = ( $(window).scrollTop() );
if( yPos > starting_position && window.innerWidth > 500 ) { // show sticky menu after these many (starting_position) pixels have been scrolled down from the top and only when viewport width is greater than 500px.
$(".nav-secondary").fadeIn();
} else {
$(".nav-secondary").fadeOut();
}
@mixin box-shadow($top, $left, $blur, $size, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $size $color;
-moz-box-shadow:inset $top $left $blur $size $color;
box-shadow:inset $top $left $blur $size $color;
} @else {
-webkit-box-shadow: $top $left $blur $size $color;
-moz-box-shadow: $top $left $blur $size $color;
box-shadow: $top $left $blur $size $color;
}
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
<div class='sandwich'>
<div class='sw-topper'></div>
<div class='sw-bottom'></div>
<div class='sw-footer'></div>
</div>
.sandwich {
width: 35px;
height: 35px;
position: absolute;
<div class="loader">
<div class="loader_inner"></div>
</div>
.loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;