Skip to content

Instantly share code, notes, and snippets.

@ZellSnippets
ZellSnippets / ACF Repeater.txt
Created July 28, 2014 05:49
PHP:ACF:Repeater
Advanced Custom Fields
// Repeater
have_rows('repeater_field_name')
get_sub_field('sub_field_name')
the_sub_field('')
// Usage
<?php if( have_rows('repeater_field_name') ): ?>
@ZellSnippets
ZellSnippets / gist:951f63b8e81422c478a6
Created July 7, 2014 08:50
Angular: CSRF Token Cookies for Drupal Services
config(['$httpProvider',
function($httpProvider) {
// Change header XSRF Name to match Drupal's required token
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-TOKEN';
}
]).
run(['$http', '$cookies',
function($http, $cookies) {
delete $cookies['XSRF-TOKEN'];
@ZellSnippets
ZellSnippets / gist:9385961
Created March 6, 2014 09:20
Mac quotation marks keys
“ Left double quotation mark — Option-[
” Right double quotation mark — Option-Shift-[
‘ Left single quotation mark — Option-]
’ Right single quotation mark — Option-Shift-]
« Double left-pointing angle quotation mark — Option-\
» Double right-pointing angle quotation mark — Option-Shift-\
‹ Single left-pointing angle quotation mark — Option-Shift-3
› Single left-pointing angle quotation mark — Option-Shift-4
@ZellSnippets
ZellSnippets / gist:9365079
Created March 5, 2014 10:52
GEN: All Genesis Action Hooks
genesis_pre
genesis_pre_framework
genesis_init
genesis_title
genesis_meta
genesis_before
genesis_after
genesis_before_header
genesis_header
genesis_after_header
@ZellSnippets
ZellSnippets / gist:9245585
Created February 27, 2014 06:52
SCSS: Sticky Footer
* {
margin: 0;
}
html, body {
height: 100%;
}
.page-wrap {
min-height: 100%;
/* equal to footer height */
margin-bottom: -142px;
@ZellSnippets
ZellSnippets / gist:8930699
Created February 11, 2014 07:45
PHP: Recursively show all data of arrays
<?php
function show_data ($data) {
foreach ($data as $key => $value) {
echo '<ul style="margin-left: 20px">';
if (gettype($value) == 'array' ) {
echo '<li>' . $key . " : " . $value . '</li>';
echo '<ul style="margin-left: 20px">';
show_data($value);
echo '</ul>';
}
@ZellSnippets
ZellSnippets / gist:8857257
Created February 7, 2014 04:09
WP: Get common items like post title and categories
<?php
/**
* Gets user information
*/
$user_info = get_userdata($user_id); // returns the user class with standard items
$user_info = get_user_meta($user_id); // returns every single meta stored in the users table
/**
@ZellSnippets
ZellSnippets / gist:8857254
Created February 7, 2014 04:07
PHP: DateTime common
<?
// Get Year
$today = new DateTime();
$year = $today->format('Y');
// Set Date
$date = new DateTime();
$date->setDate(2014, 12, 31);
@ZellSnippets
ZellSnippets / gist:8836747
Created February 6, 2014 01:18
PHP: s2members Constants Shortcode
[s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]
[s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LEVEL" /]
[s2Get constant="S2MEMBER_CURRENT_USER_CUSTOM" /]
[s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
[s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /]
[s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /]
[s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED" /]
[s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /]
[s2Get constant="S2MEMBER_CURRENT_USER_EMAIL" /]
[s2Get constant="S2MEMBER_CURRENT_USER_FIELDS" /]
@ZellSnippets
ZellSnippets / gist:8836649
Created February 6, 2014 01:06
PHP: s2member codes
<?php
$user_login = get_user_field ("user_login");
# Username for the current User.
$user_email = get_user_field ("user_email");
# Email Address for the current User.
$first_name = get_user_field ("first_name");
# First Name for the current User.