Skip to content

Instantly share code, notes, and snippets.

View feliciaceballos's full-sized avatar

Felicia Ceballos-Marroquin feliciaceballos

View GitHub Profile
<?php echo get_custom_field('_crm_proposal_first_name');?>
@feliciaceballos
feliciaceballos / Get User ID by display name
Created April 29, 2016 18:31
Get User ID by display name
function get_user_id_by_display_name($display_name) {
global $wpdb;
if ( ! $user = $wpdb->get_row( $wpdb->prepare(
"SELECT `ID` FROM $wpdb->users WHERE `display_name` = %s", $display_name
) ) )
return false;
return $user->ID;
}
@feliciaceballos
feliciaceballos / Assign Post to Author in Gravity Forms Dropdown
Created April 29, 2016 18:33
Assign Post to Author in Gravity Forms Dropdown
add_filter( 'gform_post_data_72', 'change_post_type', 10, 3 );
function change_post_type( $post_data, $form, $entry ) {
$convert_user_id = get_user_id_by_display_name($entry[170]);
if ( $form['id'] != 72 ) {
return $post_data;
}
@feliciaceballos
feliciaceballos / Hide items in Publish box
Created April 29, 2016 21:15
Hide items in Publish box
function hide_publishing_actions(){
$my_post_type = 'post';
global $post;
if($post->post_type == $my_post_type){
echo '
<style type="text/css">
.misc-pub-section.misc-pub-post-status,
.misc-pub-section.misc-pub-visibility,
#minor-publishing-actions,
#delete-action{
@feliciaceballos
feliciaceballos / Show Most Recent Comment
Created April 29, 2016 21:50
Show Most Recent Comment
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;
}
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 'notes':
echo show_most_recent_comment($post->ID);
break;
default:
break;
@feliciaceballos
feliciaceballos / gist:ab04accddbf7a5b7cc06b4c1871973a2
Created April 29, 2016 22:14
Create Notes Column with Piklist
'edit_columns' => array(
'title' => __('Client Name')
,'author' => __('Assigned to')
,'notes' => __('Notes')
@feliciaceballos
feliciaceballos / gist:9d5e599d80e4ff50988f4d3c99adec1b
Created June 13, 2016 23:28
Registering Custom Post Type in Piklist
<?php
add_filter('piklist_post_types', 'piklist_demo_post_types');
function piklist_demo_post_types($post_types)
{
$post_types['piklist_demo'] = array(
'labels' => piklist('post_type_labels', 'Piklist Demo')
,'title' => __('Enter Custom Title')
,'public' => true
,'rewrite' => array(
'slug' => 'piklist-demo'
@feliciaceballos
feliciaceballos / gist:4e26d4dcd58a44f26067b451d8fda763
Created June 13, 2016 23:39
Single Custom Template using Genesis Framework
<?php
/*
Single Client Template: Branding
Description: This is a printable sheet with brand assets for the client
*/
//* Remove Before Header widget area
remove_action( 'genesis_before_header', 'automaton_before_header' );
<?php
/*
Single Post Template: All Data Export
Description: This exports all client data
*/
?>
<table id="data-export">
<tr>
<th>Project Name</th>