Skip to content

Instantly share code, notes, and snippets.

@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-trigger-gform_after_submission-form-12.php
Last active July 3, 2023 22:38
GravityView - Trigger the `gform_after_submission` action when an entry is edited, but ONLY for Form #12.
<?php
/**
* GravityView doesn't trigger the `gform_after_submission` action when editing entries. This does that,
* but ONLY FOR FORM #12.
*
* @param array $form
* @param int $entry_id ID of the entry being updated
* @param GravityView_Edit_Entry_Render $object
*
@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-edit-entry-unrequire.php
Created November 5, 2018 22:21
GravityView - Remove required fields from Edit Entry
<?php
add_filter( 'gravityview/edit_entry/form_fields', 'gravityview_edit_entry_dont_require_fields' );
/**
* Remove the "required" setting from Gravity Forms fields in GravityView Edit Entry
*
* @return GF_Field[]
*/
function gravityview_edit_entry_dont_require_fields( $fields ) {
@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;