Skip to content

Instantly share code, notes, and snippets.

View digisavvy's full-sized avatar

Alex Vasquez digisavvy

View GitHub Profile
@digisavvy
digisavvy / new_gist_file.php
Created May 29, 2015 13:24
Right Things Banner
<section id="section-banner">
<span class="banner_noresponsive"><?php
$bannerarea = get_field("banner");
if($bannerarea == ""){
?>
<?php }else{ ?>
<img src="<?php echo get_field("banner"); ?>">
<?php } ?></span>
<span class="banner_responsive"><?php
$bannerarea_responsive = get_field("banner_responsive");
<?php
if ( 'movie' == get_post_type() ) {
/* Custom code for 'movie' post type. */
} elseif ( 'book' == get_post_type() ) {
/* Custom code for the 'book' post type. */
}
@digisavvy
digisavvy / load-page.js
Last active August 29, 2015 14:27
Use jquery to load a file into a div via an onclick event. Needed to do this to load a pageview on a single page, multi-step app where multiple pageviews needed to be recorded
jQuery(function ($) {
$(document).ready(function(){
$(".page1").click(function(){
$('#pageloader').load('path/to/file.html');
});
});
}
define('EDD_SLUG', 'my-downloads-slug');
@digisavvy
digisavvy / flexbox-col-test.css
Created August 23, 2015 19:14
Flexbox Column Test
.gallery {
overflow: auto;
zoom: 1;
display: flex;
flex-direction: row;
}
.gallery-columns-3 figure {
width: 33%;
float: left;
height: 370px;
@digisavvy
digisavvy / wc-prod-type-checker.php
Created September 11, 2015 06:32
Check WooCommerce Product Type
<?php
if( $product->is_type( 'simple' ) ){
echo "is simple product";
} elseif( $product->is_type( 'variable' ) ){
echo "is variable";
} elseif( $product->is_type( 'composite' ) ){
echo "is composite";
} else {
echo "derpage";
<head>
<!--[if IE]><![endif]-->
<link rel='stylesheet' id='kfalkner-font-awesome-css' href='//netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css?ver=4.4.0' type='text/css' media='all' />
<link rel="stylesheet" href="http://www.kristinfalkner.com/wp-content/cache/min/1/d55b692a1c3c0173104fb1e29befc0a7.css" data-minify="1" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Custom WordPress Work, PSD to WordPress, Los Angeles WordPress Developer, Web Design &amp; Development | Kristin Falkner</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="alternate" type="application/rss+xml" title="Kristin Falkner RSS Feed" href="http://www.kristinfalkner.com/feed/" />
@digisavvy
digisavvy / unreg-sidebar-in-tax.php
Created October 7, 2015 17:17
Unregister Sidebar in custom taxonomy
// Remove sidebar from product archive layouts
function digisavvy_remove_prod_cat_sidebars() {
if ( 'product_cat' == is_tax() ) {
unregister_sidebar( 'sidebar-1' ); // primary on left
}
}
add_action( 'wp_head', 'digisavvy_remove_prod_cat_sidebars', 11 );
@digisavvy
digisavvy / wp-user-to-rcp-subscriber.php
Last active October 13, 2015 16:06
Automatically add new users in WordPress to an Restrict Content Pro Subscription Level
<?php
//** Add rcp_subscription_level meta_key to users **//
// Updates user subscription upon saving the user's WP profile
add_action( 'edit_user_profile_update', 'digisavvy_auto_add_rcp_members' );
// Auto adds new user to RCP subscription
add_action( 'user_register', 'digisavvy_auto_add_rcp_members' );
function digisavvy_auto_add_rcp_members( $user_id ) {
$rcp_member = 1; // Subscription ID you're auto adding users to
@digisavvy
digisavvy / redirect-non-admin.php
Last active November 18, 2015 21:13
Redirect non-admins to current user profile page
function ds_login_redirect( $redirect_to, $request, $user ) {
$current_user = wp_get_current_user();
$url = get_site_url( );
$purl = $url . '/members/'. $current_user->user_login . '/courses/';
return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url() : $purl;
}
add_filter( 'login_redirect', 'ds_login_redirect', 10, 3 );