Skip to content

Instantly share code, notes, and snippets.

Daron Daronspence

Block or report user

Report or block Daronspence

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Daronspence
Daronspence / Front End Registration Form with ACF Fields
Last active Oct 3, 2016
Register front end form ACF wordpress
View Front End Registration Form with ACF Fields
<?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 Dec 27, 2016
Show edit form for current user ACF data/
View Current User ACF Meta Fields.php
<?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/
?>
View ACF Group Fields.php
<?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 Aug 29, 2015
jQuery Fade Each & Repeat
View Fade & Repeat.js
(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 Aug 29, 2015
Wordpress Navigation
View WordpressNav.scss
.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 Nov 7, 2018
Font Awesome Wordpress Admin Icons
View FontAwesome.php
<?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>
View g-map-acf-bug-fix.js
// 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');
View page-content-from-child-templates.php
<?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
Return an array of rules for use with register_field_group() 'location' key
View acfw_location_rules.php
<?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 ){
View acf_namespacing_ex1.php
<?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');
You can’t perform that action at this time.