Skip to content

Instantly share code, notes, and snippets.

View renventura's full-sized avatar

Ren Ventura renventura

View GitHub Profile
@renventura
renventura / custom-profile-fields.php
Created November 21, 2014 06:36
Remove default social fields and add custom fields in user profile settings.
<?php //* Mind this opening PHP tag
/*
* Removes the standard WordPress profile settings for Twitter, Google+ and Facebook
* Adds custom fields for Twitter, Facebook, LinkedIn and Google+
* Removing and adding Twitter, Google+ and Facebook is not completely necessay
* I did this so I knew exactly what these fields were doing
*/
//* Add custom meta fields
@renventura
renventura / genesis-custom-author-box.php
Last active August 29, 2015 14:10
Remove default Genesis Author Box and add a custom author box with custom fields and output.
<?php //* Mind this opening PHP tag
/*
* Removes default Genesis Author Box
* Adds a custom author box with custom user meta fields
* See https://gist.github.com/EngageWP/c2cf3be56adf5b7c9b3a for creating these custom fields
*/
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 ); // Remove default Genesis Author Box
add_action( 'genesis_after_entry', 'rv_theme_author_box', 8 ); // Do custom author box instead
@renventura
renventura / conditional-featured-images.php
Created November 26, 2014 05:56
Set conditional featured images for WordPress posts. This snippet requires the Default Featured Image plugin.
@renventura
renventura / gf-remove-lead.php
Created November 28, 2014 05:39
Automatically remove entry data after Gravity Forms submission
<?php //* Mind this opening PHP tag
/**
* Source: http://www.gravityhelp.com/documentation/page/Delete_Entry_Data_After_Post_Submission
*/
//* Automatically remove entry from database; remove _(FORMID) for all forms
add_action('gform_post_submission_1', 'remove_form_entry', 10, 2);
function remove_form_entry($entry, $form){
global $wpdb;
@renventura
renventura / invoice-cpt.php
Last active January 16, 2020 19:46
Registers an "Invoice" custom post type
<?php //* Mind this opening PHP tag
/**
* Register Invoice Type
*
* @author Ren Ventura
* @link http://www.engagewp.com/create-invoices-gravty-forms-wordpress
*/
add_action( 'init', 'rv_invoice_cpt' );
[
{
"key": "group_54765e908ee2b",
"title": "Invoice Fields",
"fields": [
{
"key": "field_54765eb0666bb",
"label": "Client Name",
"name": "invoice_client_name",
"prefix": "",
@renventura
renventura / single-invoice.php
Last active August 10, 2018 05:11
Single template for the Invoice custom post type. This template is specifically for the Genesis Framework but the important functionality can be used in any theme.
<?php //* Mind this opening PHP tag
/**
* Single invoice template
*
* @author Ren Ventura
* @link http://www.engagewp.com/create-invoices-gravty-forms-wordpress
*/
//* Define running total global variable
@renventura
renventura / send-invoice-email-on-publish.php
Created November 30, 2014 22:01
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
*/
@renventura
renventura / add-script-onto-excerpt.php
Created December 5, 2014 21:23
Filter the post excerpt to add a custom content area to the end (this area include the content of an external PHP script)
<?php //* Mind this opening PHP tag
//* Attaches an external PHP script to a post excerpt
add_filter( 'the_excerpt', 'my_custom_excerpt' );
function my_custom_excerpt( $output ) {
global $post;
ob_start();
include 'myscript.php';
@renventura
renventura / display-child-pages.php
Last active August 29, 2015 14:10
Display a list of child pages on WordPress pages using the Genesis Framework
<?php //* Mind this opening PHP tag
/**
* This function adds an unordered list of child pages right before the post content in Genesis
* The list is BEFORE the page content - change to a lower priority to show AFTER (i.e. 999)
*
* @global object $post The current post object.
*/
add_action( 'genesis_entry_content', 'rv_list_child_pages_with_thumbnails', 5 );
function rv_list_child_pages_with_thumbnails() {