Created
June 17, 2014 14:33
-
-
Save nciske/0359b4849ab898dadf57 to your computer and use it in GitHub Desktop.
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 | |
/* | |
How to use: | |
1. Create a custom field at SalesForce, long enough to hold your longest page title (i.e. at least 255 characters) | |
2. Replace PAGE_TITLE_CUSTOM_FIELD_NAME below with the name of the custom field you setup in SalesForce, | |
it will be something like PageTitle__c | |
3. Add a hidden field to your form(s) with the same field name (e.g. "PageTitle__c") | |
4. Profit | |
*/ | |
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_page_title', 10, 3 ); | |
function salesforce_w2l_field_page_title( $val, $field, $form ){ | |
// Target a specific field on all forms | |
if( $field == 'PAGE_TITLE_CUSTOM_FIELD_NAME' ) | |
$val = get_the_title(); | |
return $val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment