Skip to content

Instantly share code, notes, and snippets.

View aibrean's full-sized avatar

April Sadowski aibrean

View GitHub Profile
@aibrean
aibrean / set-post-fields-gf.php
Created March 10, 2016 16:25 — forked from joshuadavidnelson/set-post-fields-gf.php
Connect a Gravity Form upload field to ACF Gallery Field when creating a front-end post submission, requires the jdn_create_image_id function from https://gist.github.com/joshuadavidnelson/164a0a0744f0693d5746
<?php
/**
* Attach images uploaded through Gravity Form to ACF Gallery Field
*
* @author Joshua David Nelson, [email protected]
* @return void
*/
$gravity_form_id = 1; // gravity form id, or replace {$gravity_form_id} below with this number
add_filter( "gform_after_submission_{$gravity_form_id}", 'jdn_set_post_acf_gallery_field', 10, 2 );
function jdn_set_post_acf_gallery_field( $entry, $form ) {
@aibrean
aibrean / acf-field-counter.php
Created March 11, 2016 17:06 — forked from emaildano/acf-field-counter.php
ACF field counter snippet.
<?php
// get the count on the repeater field
// mabye use get_sub_field() instead of get_field() if it's nested
$count = count( get_sub_field( 'the_field' ) );
// begin $count conditions
if ( $count > 1 ) { ?>
// greater than 1
<?php the_field( 'great_than_1' ); ?>
<?php } else { ?>
@aibrean
aibrean / send-invoice-email-on-publish.php
Created March 13, 2016 16:17 — forked from renventura/send-invoice-email-on-publish.php
Send email when invoice post is created. This uses a hook specific to the Advanced Custom Field plugin.
<?php //* Mind this opening PHP tag
/**
* Send an email to the invoice_client_email custom field in the Invoice post type
* The acf/save_post hook is specific to the Advanced Custom Fields plugin
*
* @author Ren Ventura
* @link http://www.engagewp.com/create-invoices-gravty-forms-wordpress
*/
@aibrean
aibrean / image-crops
Last active April 5, 2016 16:39
Umbraco 7 and uCommerce 7 image cropper
@{
var media = product.GetPropertyValue<string>("MainProductImage");
var mediaSource = umbracoHelper.TypedMedia(media);
}
<img src="@mediaSource.GetCropUrl("umbracoFile", "store-product-medium")" class="main-image" />