Skip to content

Instantly share code, notes, and snippets.

@zackkatz
zackkatz / gravityview-modify-success-message.php
Last active August 29, 2015 14:14
Modify the message shown after successfully editing an entry in GravityView
<?php
/**
* Code example for GravityView ( https://gravityview.co )
*
* Add the following code to the end of your theme's functions.php file.
*
* Make sure it's inside the ?> if ?> is at the end of the file!!!
*
*/
@zackkatz
zackkatz / gravityview-modify-search-mode.php
Created February 3, 2015 19:51
Force searches to match all parameters, not any.
<?php
/**
* Force searches to match all parameters, not any.
*
* @link http://docs.gravityview.co/article/55-how-do-i-modify-the-search-mode
* @param string $mode 'any' or 'all'
*/
function gv_my_modify_search_mode ( $mode ) {
return 'all'; // by default is 'any'
@zackkatz
zackkatz / use-idx_plus_data-filter.php
Last active August 29, 2015 14:14
Use the `idx_plus_data` filter to define another variable.
<?php
// We want to add a new value for %%short_excerpt%%
add_filter( 'idx_plus_data_short_excerpt', 'add_short_excerpt_data_to_idx_plus', 10, 2 );
/**
* Modify the data output
*
* @param mixed $data Data to return
* @param string|null $key Data key, if set
@zackkatz
zackkatz / gravityview-force-white-space-phone-number.php
Last active December 14, 2016 22:31
Force white space after parens in phone number output
<?php
/**
* Plugin Name: GravityView - Force a space in phone number output
* Plugin URI: http://gravityview.co
* Description: Make sure parenthesis have a trailing space
* Version: 1.5.4
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
*/
@zackkatz
zackkatz / gravityview-edit-entry-hide-empty-fields.php
Last active September 5, 2022 04:10
GravityView - Hide Empty Fields in Edit Entry screen
<?php
/**
* Add filters to the edit entry inputs when GravityView starts to render an entry.
*/
add_action( 'gravityview/edit-entry/render/before', function() {
// GravityView methods are run at priority 10; by running at 20, this will run after GV.
add_filter( 'gform_field_content', 'gravityview_hide_empty_fields_in_edit_entry', 20, 5 );
} );
@zackkatz
zackkatz / edd-gf-restore-base-product.php
Created February 9, 2015 18:14
Restore base product links being included in the customer purchase.
<?php
/** Add the line below to your functions.php file after <?php and before ?> */
add_filter('edd_gf_variable_products_include_base', '__return_true');
@zackkatz
zackkatz / gravityview-datatables-translate-script.php
Created February 10, 2015 15:57
Translate the DataTables script in the GravityView DataTables extension
<?php
/**
* Add this code to your theme's functions.php file
*/
add_filter( 'gravityview/datatables/config/language', 'translate_gv_datatables' );
/**
* If you want to translate DataTables, you can use some of the existing translations
*
@zackkatz
zackkatz / idx-plus-larger-gallery-thumbnails.php
Created February 18, 2015 22:39
IDX+ - Use a larger thumbnail size in galleries, good for Retina displays
@zackkatz
zackkatz / gravityview-datatables-modify-locale.php
Created February 19, 2015 23:54
Modify the locale used by GravityView DataTables extension
<?php
add_filter( 'gravityview/datatables/config/locale', 'modify_gravityview_datatables_locale', 10, 2 );
/**
* Modify the locale used in the DataTables translation
*/
function modify_gravityview_datatables_locale( $existing_locale, $translations ) {
// Define the Locale Code, as shown here: http://wpcentral.io/internationalization/
@zackkatz
zackkatz / gravityview-enable-the-content-filter-custom-field.php
Created February 23, 2015 18:56
Apply `the_content` filter to Custom Content fields in order to process `[embed]` shortcodes.
<?php
/** Modify the content returned from the Custom Content field */
add_filter( 'gravityview/fields/custom/content_after', 'gv_add_the_content_filter_to_custom_content_field' );
/**
* This example runs `the_content` filter on the content to process `[embed]` shortcodes.
*
* @param string $content Existing field content
* @return string Modified field content