Skip to content

Instantly share code, notes, and snippets.

@hweeks
hweeks / Email Encodin
Created April 9, 2014 15:44
WordPress Email Encoder using ACF
//Your html code snippet
<?php echo(encode_email(get_field('variable-you-choose')));?>
//Your Functions file add on
function encode_email($e) {
$output = "";
for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
return $output;
}
@rickalee
rickalee / gist:10170090
Created April 8, 2014 18:47
Gravity Forms Access to Editors
function add_grav_forms(){
$role_object = get_role( 'editor' );
$role_object->add_cap( 'edit_theme_options' );
$role = get_role('editor');
$role->add_cap('gform_full_access');
}
add_action('admin_init','add_grav_forms');
function sameHeights(selector) {
var selector = selector || '[data-key="sameHeights"]',
query = document.querySelectorAll(selector),
elements = query.length,
max = 0;
if (elements) {
while (elements--) {
var element = query[elements];
if (element.clientHeight > max) {
max = element.clientHeight;
@rickalee
rickalee / gist:8290577
Last active January 2, 2016 10:29
Migrate former Base Theme to Functions.php enqueues
function swg_scripts() {
// Load our main stylesheet.
wp_enqueue_style( 'swg-style', get_stylesheet_uri() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'swg-superfish', get_template_directory_uri() . '/js/superfish.js', array( 'jquery' ), '20131209', true );