Skip to content

Instantly share code, notes, and snippets.

@zackkatz
zackkatz / gv-button-styles.css
Created Apr 12, 2021
Modify the button styles for Edit Entry in GravityView (as seen on our blog)
View gv-button-styles.css
/* Update button */
#publishing-action .gv-button-update {
background-color: #4CAF50;
border: 2px solid #4CAF50;
color: #ffffff;
padding: 15px 32px;
text-align: center;
font-size: 16px;
}
@zackkatz
zackkatz / gravityview-maps-remove-plugin-icons.php
Last active Feb 22, 2021
GravityView - Remove default icons from Maps icon picker
View gravityview-maps-remove-plugin-icons.php
<?php
/**
* Removes plugin iconset so that only theme icons remain.
*
* @param array $icons Associative array of icon URLs with `plugin` and `theme` keys.
*/
add_filter( 'gravityview/maps/available_icons/icons', function( $icons = array() ) {
$icons['plugin'] = array();
@zackkatz
zackkatz / gravity-forms-survey-star-ratings-gravityview.txt
Created Feb 9, 2021
Custom Content to show star ratings. If you have different labels in the Gravity Forms field, make sure to use those labels instead!
View gravity-forms-survey-star-ratings-gravityview.txt
[gvlogic if="{Star Rating:1}" is="Terrible"]
⭐️
[else if="{Star Rating:1}" is="Not so great"]
⭐️⭐️
[else if="{Star Rating:1}" is="Neutral"]
⭐️⭐️⭐️
[else if="{Star Rating:1}" is="Pretty good"]
⭐️⭐️⭐️⭐️
[else if="{Star Rating:1}" is="Excellent"]
⭐️⭐️⭐️⭐️⭐️
@zackkatz
zackkatz / gravityview-plugins-filter.php
Created Feb 1, 2021
GravityView - Add a "GravityView Plugins" filter to the Plugins list ("active", "inactive", etc…)
View gravityview-plugins-filter.php
<?php
/**
* Add to your functions.php file
*
* Note: this does the same thing as searching for "GravityView.co" in the plugins search box!
*/
add_filter( 'views_plugins', function( $views = array() ) {
$link = esc_html__( 'GravityView Plugins', 'gravityview' );
@zackkatz
zackkatz / gv-calendar-process-field-shortcodes.php
Last active Dec 9, 2020
GravityView Calendar - Process shortcodes contained within field values
View gv-calendar-process-field-shortcodes.php
<?php
add_filter( 'gravityview/calendar/events', 'gv_calendar_process_field_value_shortcode' );
/**
* Sometimes field values contain shortcodes you want to process. This does that.
*
* @param array $events Array of events to display on the calendar.
*
* @return array $events, but with `title` and `description` keys processed.
@zackkatz
zackkatz / add-promotion-method-affiliatewp.php
Created Dec 3, 2020
Add Promotion Method to the Affiliates table in AffiliateWP
View add-promotion-method-affiliatewp.php
<?php
/**
* Add Promotion Method to AffiliateWP affiliates table columns
*
* @since December 3, 2020
*
* @param array $prepared_columns Prepared columns.
* @param array $columns The columns for this list table.
* @param \AffWP_Affiliates_Table $this List table instance.
@zackkatz
zackkatz / gv-entry-revisions-modify-ignored-keys.php
Last active Nov 30, 2020
GravityView Entry Revisions - Modify Ignored Fields
View gv-entry-revisions-modify-ignored-keys.php
<?php
/**
* Modify the fields shown for entry revisions for Form #17
*
* @param array $ignored_keys Array of entry meta keys and field IDs to not display in the diff, for example [ 'id', 'date_updated', '1.2' ].
* @param array $form Gravity Forms form array.
*
* @returns array $ignored_keys with added fields to ignore.
*/
@zackkatz
zackkatz / gravityview-remove-bulk-actions.php
Created Nov 23, 2020
GravityView - Remove GravityView actions from the Bulk Actions menu
View gravityview-remove-bulk-actions.php
<?php
/**
* Remove GravityView actions from the Bulk Actions menu
*/
add_filter( 'gravityview/approve_entries/bulk_actions', '__return_empty_array' );
@zackkatz
zackkatz / eddsl-auto-activate.php
Last active Oct 21, 2020
Auto-activate sites on Easy Digital Downloads Software Licensing
View eddsl-auto-activate.php
<?php
add_filter( 'edd_sl_is_site_active', 'your_namespace_is_site_active_auto_activate_site', 10, 3 );
/**
* Allow active licenses to get updates if they're not at the limit, no matter what.
*
* @param false $is_active
* @param int $license_id
* @param string $passed_site_url
@zackkatz
zackkatz / gravityview-modify-field-settings.php
Last active Oct 16, 2020
GravityView - Modify Field Settings to always have some settings checked
View gravityview-modify-field-settings.php
<?php
// Run after 10 priority to make sure all the fields are added
add_filter( 'gravityview_template_field_options', 'gv_modify_field_setting_defaults', 20, 6 );
/**
* Always check "Show Label" and "Visible to Logged-in Viewers" field settings
*
* @param array $field_options Array of field options with `label`, `value`, `type`, `default` keys
* @param string $template_id Table slug