Skip to content

Instantly share code, notes, and snippets.

View daronspence's full-sized avatar

Daron daronspence

View GitHub Profile
@daronspence
daronspence / Front End Registration Form with ACF Fields
Last active February 3, 2020 15:24
Register front end form ACF wordpress
<?php if( !is_user_logged_in() ) : ?>
<form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
<input type="text" name="user_login" value="Username" id="user_login" class="input" />
<input type="text" name="user_email" value="E-Mail" id="user_email" class="input" />
<?php do_action('register_form'); ?>
<input type="submit" value="Register" id="register" />
</form>
<?php else : echo 'You are already logged in.'; endif; ?>
@daronspence
daronspence / Current User ACF Meta Fields.php
Last active December 27, 2016 21:45
Show edit form for current user ACF data/
<?php
acf_form_head(); // Place this before wp_header();
$options = array(
'post_id' => 'user_'.$current_user->ID,
'field_groups' => array($form_group_ID), // $form_group_ID is the post id of the form group to show.
'submit_value' => 'Update Profile'
);
echo '<p>Your username is <b>'.$current_user->user_login.'</b>. This cannot be changed.</p>';
acf_form( $options ); // http://support.advancedcustomfields.com/forums/topic/front-end-and-custom-user-meta/
?>
@daronspence
daronspence / ACF Group Fields.php
Last active August 29, 2015 14:06
ACF Group Fields
<?php
/**
* acf_group_fields
*
* This function return an array of all the field names within a field group.
*
* @type function
* @date 24/9/14
* @since 5.0.8
*
@daronspence
daronspence / Fade & Repeat.js
Last active August 29, 2015 14:06
jQuery Fade Each & Repeat
(function($) {
function fadeloop(){ // loops through elements and fades them sequentially
$('.my-element').each(function( index, element){
$(element).delay(index*4000).fadeIn(500).delay(3000).fadeOut(500);
});
}
function fade(){ // calls itself to repeat
window.setTimeout(fadeloop, 0);
window.setTimeout(fade, 16000);
}
@daronspence
daronspence / WordpressNav.scss
Last active August 29, 2015 14:06
Wordpress Navigation
.main-navigation {
background: #333;
position: fixed;
top: 0;
height: 4.5rem;
width: 100%;
.nav-menu {
@include container();
list-style: none;
}
@daronspence
daronspence / FontAwesome.php
Last active October 11, 2023 14:29
Font Awesome Wordpress Admin Icons
<?php
// Loads FontAwesome & assigns dashicon prefixed classes to correspond to FontAwesome fallbacks.
// This allows 'dashicons-' to be used when declaring custom post type icons.
function font_awesome_icons(){ ?>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<style>
.dashicons-before:before { font-family: dashicons, FontAwesome; }
.dashicons-suitcase:before { content: "\f0f2"; }
.dashicons-cutlery:before { content: "\f0f5"; }
</style>
@daronspence
daronspence / g-map-acf-bug-fix.js
Last active August 29, 2015 14:07
ACF G-Map Bug Fix
// LINE 3927 of input.js
/////////////////////////////
// OLD CODE
////////////////////////////
// update inputs
this.$el.find('.input-lat').val( lat );
this.$el.find('.input-lng').val( lng ).trigger('change');
<?php
$args = array(
// Get children of current page
'post_parent' => $post->ID,
'post_type' => 'page',
);
$query = new WP_Query($args);
@daronspence
daronspence / acfw_location_rules.php
Last active May 19, 2017 18:37
Return an array of rules for use with register_field_group() 'location' key
<?php
/**
* @func acfw_location_rules
* Return an array of rules for use with register_field_group() 'location' key
* @param array $a
* @param str $param
* @param str $operator
* @param bool $extended
*/
function acfw_location_rules( array $a, $param, $op, $extended = false ){
<?php
$args = array(
'post_type' => 'morning_show'
);
$actors = new WP_Query($args);
if ( $actors->have_posts() ) : while ( $actors->have_posts() ) : $actors->the_post() :
the_field('actors');