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 | |
// Faster replacement for do_shortcode *for individual shortcodes only* | |
// If you have nested shortcodes or shortcodes intermixed in content, do_shortcode() is the still the way to go. | |
// Inspired by: https://kovshenin.com/2013/dont-do_shortcode/ | |
// WordPress Core Trac Ticket: https://core.trac.wordpress.org/ticket/25435 | |
// Usage |
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 | |
/** | |
* Double Confirmation Fields | |
* http://gravitywiz.com/2012/05/01/custom-field-confirmation/ | |
*/ | |
register_confirmation_fields( 10, array( 1, 2 ), 'Your custom messages do not match.' ); | |
add_filter( 'gform_validation', 'gfcf_validation' ); | |
function gfcf_validation( $validation_result ) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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('oembed_fetch_url','ch_add_vimeo_args',10,3); | |
function ch_add_vimeo_args($provider, $url, $args) { | |
if ( strpos($provider, '//vimeo.com/') !== false ) { | |
$args = array( | |
'title' => 0, | |
'byline' => 0, | |
'portrait' => 0, | |
'badge' => 0 | |
); |
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 | |
function wpdc_count_post_meta( $post_id ){ | |
global $wpdb; | |
$sql = $wpdb->prepare( 'SELECT COUNT( meta_id ) FROM '.$wpdb->postmeta.' WHERE `post_id` = %d', $post_id ); | |
$post_meta_count = $wpdb->get_var( $sql ); |
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
add_filter( 'salesforce_w2l_cc_admin_from_name', 'yourprefix_salesforce_w2l_cc_admin_from_name' ); | |
function yourprefix_salesforce_w2l_cc_admin_from_name( $name ){ | |
// change to the field names you want to use if not using the built in fields | |
$field_names = array( 'first_name', 'last_name'); | |
$user_name_pieces = array(); | |
foreach( $field_names as $field_name ){ | |
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
add_filter('salesforce_w2l_cc_admin_replyto_email','yourprefix_salesforce_w2l_cc_admin_from_email'); | |
function yourprefix_salesforce_w2l_cc_admin_replyto_email( $email ){ | |
// change to the field name you want to use if not using the built in field | |
$field_name = 'email'; | |
// Get the email from the POST data, and sanitize it | |
$user_email = sanitize_email( $_POST[ $field_name ] ); |
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
function pht_write_file( $id, $post) { | |
$upload_dir = wp_upload_dir(); | |
$file = $upload_dir['basedir']."/publication-hub-tools/test.xml"; | |
$content = $post->post_content; | |
// convert $content to XML... | |
file_put_contents( $file, $content ); | |
} | |
add_action( 'publish_post', 'pht_write_file', 10, 2 ); |
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
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_urlredirect', 10, 3 ); | |
function salesforce_w2l_field_urlredirect( $val, $field, $form ){ | |
$postid = get_the_id(); | |
// Target a specific field on all forms | |
if( $field == 'retURL' ){ | |
if( $field == 'retURL' && $postid == '671' ) { | |
$URL = 'http://www.mycompany.com/thank-you?option=1' ; |