Skip to content

Instantly share code, notes, and snippets.

@zackkatz
zackkatz / gravityview-plugins-filter.php
Created February 1, 2021 19:45
GravityView - Add a "GravityView Plugins" filter to the Plugins list ("active", "inactive", etc…)
<?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 December 9, 2020 22:09
GravityView Calendar - Process shortcodes contained within field values
<?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 December 3, 2020 18:29
Add Promotion Method to the Affiliates table in AffiliateWP
<?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 December 15, 2021 15:26
GravityView Entry Revisions - Modify Ignored Fields
<?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 November 23, 2020 22:19
GravityView - Remove GravityView actions from the Bulk Actions menu
<?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 October 21, 2020 20:22
Auto-activate sites on Easy Digital Downloads Software Licensing
<?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 October 16, 2020 01:00
GravityView - Modify Field Settings to always have some settings checked
<?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
@zackkatz
zackkatz / gravityview-gravity-flow-clear-cache.php
Last active July 29, 2020 06:50
GravityView - Clears results cache after running Gravity Flow workflow
<?php
// Add the code below to your functions.php file. Will be included in GravityView 2.9 release.
add_action( 'gravityflow_post_process_workflow', 'gv_clear_cache_after_workflow', 10, 4 );
/**
* Clears GravityView entry cache after running a Gravity Flow Workflow
*
* Thanks to @CodenomadIndia for improved code!
@zackkatz
zackkatz / gravityview-anchor-after-search.php
Last active June 1, 2020 23:32
GravityView - How to navigate to an anchor after search
<?php
/**
* Modify the action of the Search Bar form to navigate to #site-content anchor after search
*
* @param string $url Where the form submits to.
*
* @returns string Modified URL with anchor added
*/
add_filter( 'gravityview/widget/search/form/action', function ( $url ) {
@zackkatz
zackkatz / gv-calendar-remove-time-display.php
Last active May 24, 2020 20:35 — forked from rafaehlers/gv_calendar_remove_time_display.php
Gravity Forms Calendar - Prevent time from being displayed in the calendar
<?php // DO NOT COPY THIS LINE
/**
* Remove the time from being displayed on a GravityView calendar
*
* @see https://docs.gravityview.co/category/647-calendar
*
* @param array $calendar_options Array of FullCalendar options
*
* @return mixed