Skip to content

Instantly share code, notes, and snippets.

View feliciaceballos's full-sized avatar

Felicia Ceballos-Marroquin feliciaceballos

View GitHub Profile
function show_most_recent_comment($post_id) {
$args = array(
'number' => '1',
'post_id' => $post_id,
);
$comments = get_comments($args);
foreach($comments as $comment) :
echo($comment->comment_author . '<br>' . $comment->comment_content. '<br>' .$comment->comment_date);
endforeach;
}
/**
Piklist Create Custom Post Types
Creates Portfolio Items, Clients and Prospects
*/
add_filter('piklist_post_types', 'automaton_post_types');
function automaton_post_types($post_types)
{
$post_types = array_merge($post_types, array(
'portfolio' => array(
@feliciaceballos
feliciaceballos / gist:42f452919ee85b0cdb86fcf9adc12f1f
Created April 18, 2016 23:10
Dynamically populate drop down in Gravity Forms with list of users with author role
//replace 72 below with your form id number
add_filter( 'gform_pre_render_72', 'populate_posts' );
add_filter( 'gform_pre_validation_72', 'populate_posts' );
add_filter( 'gform_pre_submission_filter_72', 'populate_posts' );
add_filter( 'gform_admin_pre_render_72', 'populate_posts' );
function populate_posts( $form ) {
/*
Title: My Metabox
Description: My cool new metabox
Post Type: my_post_type
//if using a custom post type, enter the name of the post type above
*/
//field starts
piklist('field', array(
'type' => 'text'
@feliciaceballos
feliciaceballos / gist:8971704f5b6a653c610dcb48178470fc
Created April 24, 2016 02:05
Create Aurora Borealis Effect with CSS Animation
.aurora-borealis {
background: linear-gradient(#05051f, #05051f, #97f7f3, #05051f, #05051f, #05051f, #76f6bd, #aaebc9, #05051f, #05051f, #69c1ff, #cb304f, #05051f, #05051f, #05051f, #05051f, #4a5b8f, #419f91, #05051f, #05051f, #3a4aa1, #db3b69, #05051f);
background-size: 1800% 1800%;
-webkit-animation: Aurora 180s ease;
-moz-animation: Aurora 180s ease;
animation: Aurora 180s ease;
animation-iteration-count: 1;
}
@-webkit-keyframes Aurora {
@feliciaceballos
feliciaceballos / gist:a9f650ece910635d127cb97ac89195d0
Last active April 25, 2016 22:35
Customize Columns in Post List View with Piklist
'edit_columns' => array(
'title' => __('Client Name')
,'author' => __('Assigned to')
,'client_email' => __('Email Address')
,'client_phone' => __('Phone Number')
@feliciaceballos
feliciaceballos / gist:ddc7604663d1f838bc5917aa283d4ec4
Last active April 25, 2016 22:37
Populate Custom Fields in Post List View
function populate_custom_fields_in_post_list_view ($column_name, $id ) {
global $post;
$email = get_post_meta( $post->ID, 'automaton_client_email', true);
switch ($column_name) {
case 'client_email':
echo email_template($email);
break;
case 'client_phone':
@feliciaceballos
feliciaceballos / gist:60f978ef743905b146376df17d96cb37
Created April 25, 2016 22:52
Create Email Templates based on Prospect Status
function email_template($email) {
global $wp_query, $post;
$welcome_email = "<a href=mailto:$email?Subject=Thank%20You%20for%20your%20Inquiry&body=I%20will%20review%20your%20needs%20and%20get%20back%20to%20you%20with%20an%20estimate%20in%20the%20next%2048%20hours.%0A%0AWe%20look%20forward%20to%20speaking%20with%20you%20soon.>$email</a>";
$estimate_follow_up = "<a href=mailto:$email?Subject=Estimate%20Follow%20Up&body=I%20wanted%20to%20follow%20up%20on%20the%20estimate%20I%20sent%20over%20a%20few%20days%20ago%20and%20see%20if%20you%20had%20any%20questions.%20When%20is%20a%20good%20time%20for%20us%20to%20get%20on%20the%20phone%20and%20go%20over%20it%20together?%0A%0AYou%Thanks,>$email</a>";
$general_follow_up = "<a href=mailto:$email?Subject=Following%20Up>$email</a>";
if (in_category('new-lead')) :
@feliciaceballos
feliciaceballos / Reference Custom Single Post Templates
Last active April 27, 2016 20:18
Reference Custom Single Post Templates
// Define a constant path to plugin folder
define(SINGLE_PATH, plugin_dir_path( __FILE__ ). '/templates');
// Filter the single_template with our custom function
add_filter('single_template', 'my_single_template');
function my_single_template($single) {
global $wp_query, $post;
@feliciaceballos
feliciaceballos / Bill Erickson Get Custom Field
Created April 27, 2016 20:20
Bill Erickson Get Custom Field
function get_custom_field($field) {
global $post;
$value = get_post_meta($post->ID, $field, true);
if ($value) return esc_attr( $value );
else return false;
}