Skip to content

Instantly share code, notes, and snippets.

@zackkatz
zackkatz / add-radius-options-to-search.php
Created June 16, 2024 22:46
GravityView Maps - Add more radius search options
<?php
/**
* Add larger-radius options for geolocation radius search.
*
* @param array $options Nested array. `value` key maps to the size of the radius.
*
* @return array Modified array of options.
*/
add_filter( 'gk/gravitymaps/geolocation_radius_options', function ( $options ) {
@zackkatz
zackkatz / .php
Created December 11, 2023 19:49
GravityView - Always show the label by default
<?php
/**
* Always show the field label by default.
*
* @param array $field_options Default field options for each field in View Configuration screen.
*
* @return array
*/
add_filter( 'gravityview_template_field_options', function( $field_options ) {
@zackkatz
zackkatz / gravity-forms-cookie-merge-tag.php
Created December 7, 2023 20:17
Gravity Forms - Add a {cookie} Merge Tag
@zackkatz
zackkatz / add-event-source-to-calendar.php
Last active November 29, 2023 22:05
GravityCalendar - Add a sample event feed
<?php
/**
* Example of how to add a sample event source.
*
* @param array $sources The array of event sources. {
* @type string $url The URL of the event source.
* @type string $type The type of event source. Either `ics` or `json`.
* @type string $color The color of the event source.
* }
@zackkatz
zackkatz / gravityedit-filter-editable-style.php
Created November 21, 2023 18:05
GravityEdit - Filter the jQuery UI theme
<?php
/**
* @filter `gravityview-inline-edit/jquery-ui-theme` Modify the jQuery UI theme to use, if jQuery UI editor style is active
*
* @since 1.0
*
* @param string $jquery_ui_theme Name of jQuery UI theme to use. Default: "base"
*
* @see http://jqueryui.com/themeroller/#themeGallery for examples
@zackkatz
zackkatz / gravityview-entry-container-user-role.php
Last active October 20, 2023 00:14
GravityView - Wrap entries in a custom CSS class containing the user role of entry creator
<?php
/**
* Adds a CSS class for each user role.
*
* @param string $class The existing class.
* @param \GV\Template_Context The context.
*
* @return string The modified class, which will be sanitized by {@see gravityview_sanitize_html_class()} after return.
*/
@zackkatz
zackkatz / gravityview-next-prev-entry-nav.php
Last active May 24, 2023 18:28
GravityView - Show Next/Prev Entry Navigation
<?php
/**
* ::WARNING::
* This is an early work-in-progress!
*
* There are known issues, namely: This works only with no search values for now.
* It supports sorting, but that's pretty much it. It hasn't been thoroughly tested!
* Use at your own risk.
*
* @license GPL-2.0+
@zackkatz
zackkatz / gravityview-filter-by-gravity-flow-assignee.php
Last active March 10, 2023 20:17
GravityView - Filter Entry Notes by Gravity Flow Assignee.
<?php
/**
* GravityView - Filter Entry Notes by Gravity Flow Assignee.
* @license https://opensource.org/license/gpl-2-0/ GPL-2.0
*/
apply_filters( 'gravityview/entry_notes/get_notes', 'filter_gravityview_notes_by_gravity_flow_assignee', 10, 2 );
/**
* Filter the notes by Gravity Flow assignee.
@zackkatz
zackkatz / gv-remote-entry-approval-notes.php
Created March 10, 2023 19:56 — forked from rafaehlers/gv-remote-entry-approval-notes.php
Prevent Entry Approval Notes from displaying on the View
<?php // DO NOT COPY THIS LINE
add_filter( 'gravityview/entry_notes/get_notes', 'gv_remove_entry_approval_notes', 10, 2 );
function gv_remove_entry_approval_notes( $notes, $entry_id ) {
foreach($notes as $key => $note){
if (strpos( $note->value, 'WordPress') !== false){
unset( $notes[ $key] );
}
}
return $notes;
@zackkatz
zackkatz / gv-divi-widgets.php
Last active March 8, 2023 17:50 — forked from rafaehlers/gv-divi-widgets.php
Prevent a Divi-powered theme from disabling GravityView's widgets when the View is embedded in a page
<?php
/**
* Prevent Divi from using the "Grab the first post image" setting.
*
* It uses et_first_image() which uses apply_filters( 'the_content' ) which causes
* a conflict GravityView, which uses 'the_content' filter.
*
* @param bool $setting Is the setting enabled and the request is not Buddypress?
*