Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
@dexit
dexit / gw-gravity-forms-disable-autocomplete.php
Created September 9, 2020 09:55 — forked from spivurno/gw-gravity-forms-disable-autocomplete.php
Gravity Wiz // Gravity Forms // Disable Auto-complete
<?php
// Disable auto-complete on form.
add_filter( 'gform_form_tag', function( $form_tag ) {
return str_replace( '>', ' autocomplete="off">', $form_tag );
}, 11 );
// Diable auto-complete on each field.
add_filter( 'gform_field_content', function( $input ) {
return preg_replace( '/<(input|textarea)/', '<${1} autocomplete="off" ', $input );
@dexit
dexit / gp-limit-choices-shared-limits-field.php
Created September 9, 2020 12:56 — forked from spivurno/gp-limit-choices-shared-limits-field.php
Gravity Perks // Limit Choices // Shared Limits Field
<?php
/**
* Gravity Perks // Limit Choices // Shared Limits Field
*
* Share limits across choices of the same field.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/documentation/gravity-forms-limit-choices/
@dexit
dexit / gp-populate-anything-populate-child-entries.php
Created September 9, 2020 12:56 — forked from spivurno/gp-populate-anything-populate-child-entries.php
Gravity Perks // Populate Anything // Populate Child Entries
<?php
/**
* Gravity Perks // Populate Anything // Populate Child Entries
*
* Populate child entries from a Nested Form field into any multi-choice field.
*
* Instructional Video:
* https://www.loom.com/share/7b26b18f78624e0ca4bcd2b574636b8b
*
* Step 1 - Configure a Parent Entry Field
@dexit
dexit / gw-gravity-forms-choice-counter.php
Created September 9, 2020 12:56 — forked from spivurno/gw-gravity-forms-choice-counter.php
Gravity Wiz // Gravity Forms // Choice Counter
<?php
/**
* Gravity Wiz // Gravity Forms // Choice Counter
*
* Get the total number of checkboxes checked or multi-select options selected. Useful when wanting to apply conditional
* logic based on those totals.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
<?php
/**
* Gravity Perks // Media Library // Set Upload Directory
* http://gravitywiz.com/documentation/gravity-forms-media-library/
*/
add_filter( 'gpml_media_data', function( $return ) {
add_filter( 'upload_dir', 'gpml_set_upload_dir' );
if( ! function_exists( 'gpml_set_upload_dir' ) ) {
function gpml_set_upload_dir( $upload_dir ) {
$upload_dir['path'] = ABSPATH . 'wp-content/uploads/paramountregistry';
/**
* Gravity Perks // Pay Per Word // Surprise, Pay Per Character!
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/
*/
gform.addFilter( 'gpppw_word_count', function( wordCount, text, gwppw, ppwField, formId ) {
// Pay per character instead of words.
var words = text.split( '' );
return words == null ? 0 : words.length;
} );
<?php
/**
* Gravity Wiz // Gravity Forms // Email Header to Identify Notification Source
*
* You've installed Gravity Forms on a ton of sites and now you're getting a ton of notifications. The problem is there
* is no clear indicator which site is sending the notification. How frustrating!
*
* This simple plugin automatically adds a custom header that identifies the URL that generated the Gravity Forms notification.
* This is most useful when installed as an MU plugin at the start of development on each site.
*
@dexit
dexit / allow-users-to-view-network.php
Created September 9, 2020 12:58 — forked from ronalfy/allow-users-to-view-network.php
WP Force Login - Multisite - Allow All Logged In Users to View Network
<?php
/*
* Multisite for https://wordpress.org/plugins/wp-force-login/
* Allows all users of the network to view all sites and posts on the network
* Intended to be used as an mu-plugin
*/
add_action( 'template_redirect', function() {
if ( is_user_logged_in() ) {
remove_action('template_redirect', 'v_forcelogin');
}
@dexit
dexit / gravity-forms-gtm.php
Created September 9, 2020 12:58 — forked from ronalfy/gravity-forms-gtm.php
Google Tag Manager for Gravity Forms
<?php
add_action( 'gform_after_submission', 'braums_after_submission', 10, 2 );
function braums_after_submission( $entry, $form ) {
?>
<script>
function braums_datalayer_push() {
var form_submission = sessionStorage.getItem('entry_<?php echo absint( $entry[ 'id' ] ); ?>');
if ( null == form_submission ) {
if ( typeof( dataLayer ) != 'undefined' ) {
dataLayer.push({'event': 'BWTrackEvent',
@dexit
dexit / cpt-template-init.php
Created September 9, 2020 12:59 — forked from ronalfy/cpt-template-init.php
Custom Post Types Template Init
<?php
public function init() {
add_action( 'add_meta_boxes', array( &$this, 'register_meta_boxes' ) );
$labels = array(
'name' => 'Galleries',
'singular_name' => 'Gallery',
'menu_name' => 'Galleries',
'name_admin_bar' => 'Galleries',
'add_new' => 'Add New',
'add_new_item' => 'Add New Gallery',