Skip to content

Instantly share code, notes, and snippets.

View luistinygod's full-sized avatar

Luis Godinho luistinygod

  • Dekode
  • Porto, Portugal
View GitHub Profile
@luistinygod
luistinygod / gravityview-required-search-fields.php
Last active August 29, 2015 14:08
GravityView Make (some) Search Fields Required
<?php
/**
* If you need to make some of the GravityView search fields required before search is submited
* - add as many lines as you need to define which fields are required
* e.g. -> jQuery('#gv_search_XYZZ').prop('required', true );
*
* Add this gist to your theme functions.php
*
*/
@luistinygod
luistinygod / gv-custom-required-search-fields.php
Last active August 29, 2015 14:08
GravityView Make (some) Search Fields Required (custom plugin)
<?php
/*
Plugin Name: GravityView - Custom Required Search Fields
Plugin URI: https://gravityview.co/
Description: Custom Add-on to make certain GravityView Search fields required before performing the search
Author: Katz Web Services, Inc.
Version: 1.0.0
Author URI: http://www.katzwebservices.com
Copyright 2014 Katz Web Services, Inc. (email: info@katzwebservices.com)
@luistinygod
luistinygod / gv-redirect-login-page.php
Created January 9, 2015 17:19
GravityView Force not logged users to login before seeing the single entry view
<?php
/*
Plugin Name: GravityView - force login before single view
Plugin URI: https://gravityview.co/
Description: Redirect visitors to login page before seeing the single entry view
Author: Katz Web Services, Inc.
Version: 1.0.0
Author URI: http://www.katzwebservices.com
Copyright 2015 Katz Web Services, Inc. (email: info@katzwebservices.com)
@luistinygod
luistinygod / gist:e2bc8a6c88b207c4ead4
Created January 12, 2015 19:04
Adds a 'clear' button to your GravityView Search Bar
<?php
/* Add this to your theme's functions.php file */
// Adds a 'clear' button to your GravityView Search Bar
add_action( 'gravityview_search_widget_fields_after', 'my_gv_clear_search_button' );
function my_gv_clear_search_button() {
$url = strtok( add_query_arg( array() ), '?' );
?>
<a href="<?php echo esc_url( $url ); ?>" class="button gv-search-button">Clear</a>
<?php
@luistinygod
luistinygod / gist:9dcb82e1eed60ee7e4b1
Last active August 29, 2015 14:14
Force GravityView search to be exact for a certain field (Operator 'is' instead of 'like')
<?php
/**
* Place this in your theme's functions.php
* Please adapt the form_id and the field key to your own case.
* This is intended to force GravityView to search for the exact value instead of be more relaxed (default search uses operator LIKE)
*
*/
add_filter( 'gravityview_fe_search_criteria', 'my_gv_exact_search', 20, 2 );
@luistinygod
luistinygod / gist:8d9ded0fbdc0d16a4f29
Created January 29, 2015 15:38
GravityView: Do not allow to edit a field if the field has a specific value
<?php
/**
* Do not allow a certain user to edit a field if that field has a specific value
*
* Replace the following to your own values:
* - REPLACE_BY_FORM_ID, use the form id where this logic applies
* - REPLACE_BY_FIELD_ID, use the field id where this logic applies
*
*
@luistinygod
luistinygod / gist:0d49b2b0f530f6c6fce1
Created February 13, 2015 11:47
GravityView: How to change the Search Entries label on the Search Widget
<?php
/*
* Supported on GravityView 1.6
*
* Add this to your theme's functions.php file
*
* Replace the string 'MY NEW LABEL' for your own
*/
@luistinygod
luistinygod / gravityview-datatables-disable-processing.php
Created March 10, 2015 11:13
GravityView DataTables: Disable DataTables processing indicator ( WordPress plugin)
<?php
/*
* Plugin Name: GravityView - Disable DataTables processing indicator.
* Plugin URI: http://gravityview.co/extensions/datatables/
* Description: Disable the DataTables display of a 'processing' indicator when the table is being processed (e.g. a sort).
* Version: 1.0
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@luistinygod
luistinygod / gist:cb10a23327db2bae0d3c
Created March 13, 2015 16:26
GravityView DataTables: How to change the CSV file field separator
<?php
/**
* Change the field separator when exporting a DataTable view into a CSV file
* Replace MY_FIELD_SEPARATOR by the new separator character like '|' or ';'
*/
function my_gv_datatables_csv_export_separator( $config, $view_id ) {
if( empty( $config['tableTools']['aButtons'] ) ) {
return $config;
@luistinygod
luistinygod / gist:d88e0141449b4b9476ed
Created May 1, 2015 15:21
GravityView DataTables - Disable DataTables Search Filter and paging
<?php
/*
* Plugin Name: GravityView - Disable DataTables Search Filter and paging
* Plugin URI: http://gravityview.co/extensions/datatables/
* Description: Disable the DataTables search filter and paging input.
* Version: 1.0
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html