Skip to content

Instantly share code, notes, and snippets.

View luistinygod's full-sized avatar
🎯
Focusing

Luis Godinho luistinygod

🎯
Focusing
  • Porto, Portugal
View GitHub Profile
@luistinygod
luistinygod / gist:7594392d3a474cf93df0
Last active November 7, 2016 18:04
GravityView: Show the result of a calculation using a Custom Content field
<?php
/** Modify the content returned from the Custom Content field */
add_filter( 'gravityview/fields/custom/content_before', 'my_gv_custom_content_before', 10, 1 );
/**
* Replaces the %CALC% placeholder by the result of a calc operation between entries' fields
*
* @param string $content Custom Content field content
* @return string
*/
@luistinygod
luistinygod / gravityview-datatables-disable-processing.php
Created March 10, 2015 11:13
GravityView DataTables: Disable DataTables processing indicator ( WordPress plugin)
<?php
/*
* Plugin Name: GravityView - Disable DataTables processing indicator.
* Plugin URI: http://gravityview.co/extensions/datatables/
* Description: Disable the DataTables display of a 'processing' indicator when the table is being processed (e.g. a sort).
* Version: 1.0
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@luistinygod
luistinygod / gist:cb10a23327db2bae0d3c
Created March 13, 2015 16:26
GravityView DataTables: How to change the CSV file field separator
<?php
/**
* Change the field separator when exporting a DataTable view into a CSV file
* Replace MY_FIELD_SEPARATOR by the new separator character like '|' or ';'
*/
function my_gv_datatables_csv_export_separator( $config, $view_id ) {
if( empty( $config['tableTools']['aButtons'] ) ) {
return $config;
@luistinygod
luistinygod / gist:d88e0141449b4b9476ed
Created May 1, 2015 15:21
GravityView DataTables - Disable DataTables Search Filter and paging
<?php
/*
* Plugin Name: GravityView - Disable DataTables Search Filter and paging
* Plugin URI: http://gravityview.co/extensions/datatables/
* Description: Disable the DataTables search filter and paging input.
* Version: 1.0
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@luistinygod
luistinygod / gist:2ff8e39090d4e5f44615
Created May 7, 2015 17:51
GravityView DataTables - Disable the stateSave option
<?php
/**
* Disable the State Saving on your DataTables view
* @link https://datatables.net/reference/option/stateSave
*/
add_filter( 'gravityview_datatables_js_options', 'my_gv_state_save', 20, 2 );
/**
* @param array $config Holds the DataTables table configuration
* @param string $view_id The current view id
@luistinygod
luistinygod / gist:e07519bc0fe760d64404
Created May 26, 2015 18:59
GravityView: Remove hardcoded image width on multiple entries view
<?php
/**
* Add this to functions.php file
*/
add_filter( 'gravityview_image_html', 'my_gv_remove_image_width', 10, 1 );
/**
* Remove the image fixed hardcoded width on the multiple entries
*/
@luistinygod
luistinygod / maps-gist.php
Created July 27, 2015 18:44
GravityView Maps Premium View: Customise the address field ID
<?php
/**
* Custom Maps address field ID
* @param mixed $field_id Gravity Forms field ID
* @param GravityView_View object $view Current View object
*/
function my_gv_maps_address_field( $field_id, $view ) {
if ( 'MY_VIEW_ID' != $view->view_id ) {
return $field_id;
}
@luistinygod
luistinygod / maps-address.php
Created July 27, 2015 18:59
GravityView Maps Premium View: Filter the address field content before using it to geocode
<?php
/**
* Filter the address field content before geocoding
* @param string $address Address value
* @param array $entry Gravity Forms entry object
*/
function my_gv_maps_address_value( $address, $entry ) {
if ( 'MY_FORM_ID' != $entry['form_id'] ) {
return $address;
}
@luistinygod
luistinygod / gv-success-update-message.php
Last active November 10, 2015 00:54
GravityView: Change the Update Entry success message
<?php
/**
* Change the update entry success message, including the link
*
* @param $message string The message itself
* @param $view_id int View ID
* @param $entry array The Gravity Forms entry object
* @param $back_link string Url to return to the original entry
*/
function gv_my_update_message( $message, $view_id, $entry, $back_link ) {
@luistinygod
luistinygod / grid-view.php
Created August 18, 2015 15:14
GravityView: Convert a list view into a grid style (3-col)
<?php
/**
* Add the `gv-grid` class to the list container
*/
function my_gv_list_container( $classes ) {
return $classes . ' gv-grid';
}
add_filter( 'gravityview/render/container/class', 'my_gv_list_container', 10, 1 );
/**