Skip to content

Instantly share code, notes, and snippets.


Felicia Ceballos-Marroquin feliciaceballos

View GitHub Profile
View gist:3346cb7b144d30a3f7c59631750881b4
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);
View Piklist Create Custom Post Types
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 / gist:42f452919ee85b0cdb86fcf9adc12f1f
Created Apr 18, 2016
Dynamically populate drop down in Gravity Forms with list of users with author role
View gist:42f452919ee85b0cdb86fcf9adc12f1f
//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 ) {
feliciaceballos / gist:a9f650ece910635d127cb97ac89195d0
Last active Apr 25, 2016
Customize Columns in Post List View with Piklist
View gist:a9f650ece910635d127cb97ac89195d0
'edit_columns' => array(
'title' => __('Client Name')
,'author' => __('Assigned to')
,'client_email' => __('Email Address')
,'client_phone' => __('Phone Number')
feliciaceballos / gist:ddc7604663d1f838bc5917aa283d4ec4
Last active Apr 25, 2016
Populate Custom Fields in Post List View
View gist:ddc7604663d1f838bc5917aa283d4ec4
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);
case 'client_phone':
feliciaceballos / gist:60f978ef743905b146376df17d96cb37
Created Apr 25, 2016
Create Email Templates based on Prospect Status
View gist:60f978ef743905b146376df17d96cb37
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 / Reference Custom Single Post Templates
Last active Apr 27, 2016
Reference Custom Single Post Templates
View 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;
View 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;
View Creating Custom Fields with Piklist
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'