This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove the ability of a user to import entries based on their role. | |
* | |
* @param array $caps Array of capabilities required to display the UI. | |
* | |
* @return array | |
*/ | |
add_filter( 'gravityview/import/capabilities', function ( $caps ) { | |
// REPLACE THIS with the role you want to exclude from importing entries. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // DO NOT COPY THIS LINE!!!!! | |
add_filter( 'gravityview_datatables_js_options', 'gv_dt_disable_paging_search_and_length_menus', 10, 3 ); | |
/** | |
* Remove the page length, pagination menus, and search field from DataTables | |
* @param array $dt_config DataTables options | |
* @param int $view_id View ID | |
* @param WP_Post $post Current WordPress post object | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gravityview/entry_notes/get_notes', function( $notes ) { | |
if ( ! $notes ) { | |
return $notes; | |
} | |
return array_reverse( $notes, true ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gravityview_datatables_js_options', 'gv_dt_prevent_state_save', 10, 3 ); | |
/** | |
* Prevent DataTables from saving state between page loads. | |
* @param array $dt_config DataTables options | |
* @param int $view_id View ID | |
* @param WP_Post $post Current WordPress post object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Shortcode for Site URL - Use [site_url] for Shortcode | |
add_action( 'init', function() { | |
add_shortcode( 'site_url', function( $atts = null, $content = null ) { | |
return site_url(); | |
} ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable lazy loading for images in GravityView (added in 2.14.3). | |
* | |
* @param string|bool $value The `loading` attribute value. Returning a falsey value will result in | |
* the attribute being omitted for the image. | |
* @param string $image The HTML `img` tag to be filtered. | |
* @param string $context Additional context about how the function was called or where the img tag is. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disables the "Show Label" setting by default for new Views. | |
* | |
* @return array $field_options Original array with `show_label` disabled. | |
*/ | |
add_filter( 'gravityview_template_field_options', function( $field_options = array() ) { | |
$field_options['show_label'] = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Override the default query collation for the letter comparison (Requires GravityView A-Z Filters version 1.3 or newer). | |
* @param null|string $collation_override The collation override for the query. | |
* @param string $query The MySQL query passed to the database. | |
* @return string | |
*/ | |
add_filter( 'gravityview/az_filter/collation', function ( $collation = null ) { | |
return 'utf8mb4_bin'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery( 'body' ).on( 'gravityview/tab-ready', function ( ui, panel ) { | |
// This will print the jQuery DOM element of the newly-activated tab | |
console.log( panel ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Modify the text for the default option in a select (multi or single dropdown) | |
* | |
* @param string $default_option Default: `—` (—) | |
* @param string $field_type Field type: "select" or "multiselect" | |
* | |
* @return string | |
*/ |