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 / config.json
Created October 11, 2019 04:55
Tailwind Config - tailwindcss.now.sh
{
"variants": {
"borderColor": ["responsive", "hover", "focus", "focus-within"]
}
}
<?php
/*
Template Name: Restuarant Menu Template
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
@daronspence
daronspence / acf-copy-repeater-field-to-singular.php
Created May 2, 2019 06:32
Copy last row of ACF field to hidden custom fields on save
<?php
/**
* Plugin Name: ACF Copy Repeater Field to Singular - docs_list_renew
* Version: 0.1
* Description: Copies the values of the last row of a repeater field to separate custom fields to be used with Admin Columns
*/
// Rename the second argument if you're going to copy the plugin to work with another repeater.
add_action('wp_insert_post', 'reddit_acf_copy_repeater_field_to_singular', 10);
@daronspence
daronspence / webpack.mix.js
Created April 27, 2019 14:35
Laravel Mix with Sass and Tailwind 1.0 Configuration
const mix = require('laravel-mix');
require('laravel-mix-tailwind');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
<?php if( have_rows('partners_logos', $acfw) ): ?>
<?php while( have_rows('partners_logos', $acfw) ): the_row(); ?>
<div class="col-md-6">
<img src="<?php the_sub_field('logo', $acfw); ?>" alt="" class="img-responsive">
</div>
<?php endwhile; ?>
<?php endif; ?>
@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 ){
@daronspence
daronspence / documentation.md
Last active April 11, 2017 06:25
Documentation for basic WordPress Usage

Posts (Blog)

Editing a Post

  • Click on Posts in the left hand menu.
  • Click the title of the post you would like to edit.
  • Make your edits.
  • Click the "Update" button near the top right hand corner.

Update Button

@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 / count-podcasts.php
Last active December 12, 2016 16:16
Podcast Count Shortcode
<?php
/**
* Plugin Name: Podcast Shortcode
* Description: Adds a shortcode to display your podcast count. <code>[podcast-count]</code>
* Version: 1.0
* Author: Daron Spence
* Author URI: https://daronspence.com/
*
* A simple shortcode to display the number of published podcasts on your site. Uses the `podcast` post type.
*