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( 'gform_replace_merge_tags', function ( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) { | |
$merge_tag = '{gv_now_timestamp}'; | |
if ( strpos( $text, $merge_tag ) === false ) { | |
return $text; | |
} | |
$local_timestamp = GFCommon::get_local_timestamp( time() ); | |
//$local_date = date_i18n( 'Y-m-d', $local_timestamp, true ); | |
return str_replace( $merge_tag, $local_timestamp, $text ); | |
}, 10, 7 ); |
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_action( 'wpseo_opengraph', 'my_gv_wpseo_opengraph_image', 10, 1); | |
function my_gv_wpseo_opengraph_image( $img ) { | |
if( ! function_exists('gravityview_is_single_entry') || ! function_exists( 'gravityview_get_entry') ) { | |
return $img; | |
} | |
// get single entry id | |
$entry_id = gravityview_is_single_entry(); | |
if( empty( $entry_id ) ) { | |
return $img; |
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 | |
/** The defaults below are just for reference to use with the filter: | |
$defaults = array( | |
'fields' => $fields, | |
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Review', 'noun', 'gravityview-ratings-reviews' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', | |
// This filter is documented in wp-includes/link-template.php | |
'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.', 'gravityview-ratings-reviews' ), wp_login_url( $permalink ) ) . '</p>', | |
// This filter is documented in wp-includes/link-template.php | |
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'gravityview-ratings-reviews' ), get_edit_user_link(), $user_identity, wp_logout_url( $permalink ) ) . '</p>', | |
'comment_notes_befo |
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( 'gform_is_value_match', function( $is_match, $field_value, $target_value, $operation, $source_field, $rule ) { | |
/** | |
* Fix this issue for dates temporarily: | |
* https://github.com/gravityforms/gravityforms/commit/9d37fee852fe9946f030938bfa231e762f687728#commitcomment-23642339 | |
*/ | |
if ( ! $is_match && is_string( $field_value ) && is_string( $target_value ) ) { | |
switch ( $operation ): | |
case '>': return $field_value > $target_value; | |
case '<': return $field_value < $target_value; |
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_shortcode( 'gv_tag', 'gv_tag_shortcode' ); | |
function gv_tag_shortcode( $atts ) { | |
extract( shortcode_atts( | |
array( | |
'field' => '', | |
), $atts ) | |
); | |
$links = ""; |
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( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value ) { | |
if( 'all_fields' !== $merge_tag && 'maxwords2' === $modifier ) { | |
/* Number of words to display */ | |
$max = 4; | |
$more_placeholder = '…'; | |
/** |
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 //this entire line should be removed when copying this code, before pasting it into your functions.php file | |
/** Remove default order from DataTables */ | |
add_filter( 'gravityview_datatables_js_options', function( $dt_config, $view_id, $post ) { | |
$dt_config['order'] = array(); | |
$dt_config['stateSave'] = false; | |
return $dt_config; | |
}, 10, 3 ); |
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 // remove this whole line when copying this code to your theme's function.php file | |
add_shortcode( 'gvgravatar', 'gv_gravatar_shortcode' ); | |
function gv_gravatar_shortcode( $atts ) { | |
extract( shortcode_atts( | |
array( | |
'email' => '', | |
), $atts ) | |
); | |
$md5 = md5($email); | |
$image = '<img src="https://secure.gravatar.com/avatar/'.$md5.'?s=55">'; |
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_entries', function( $entries, $criteria, $passed_criteria, &$total ) { | |
$view_id = GravityView_frontend::getInstance()->get_context_view_id(); | |
if ( $view_id != 97 /** Augmented View ID here */ ) { | |
return $entries; | |
} | |
$_subtract = $criteria; |
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
<script type="text/javascript"> | |
(function($){ | |
$(document).ready(function(){ | |
$("p.gv-back-link a").attr("href", "javascript:history.back()"); | |
}); | |
})(window.jQuery); | |
</script> |