Skip to content

Instantly share code, notes, and snippets.

@nciske
Created June 17, 2014 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nciske/0359b4849ab898dadf57 to your computer and use it in GitHub Desktop.
Save nciske/0359b4849ab898dadf57 to your computer and use it in GitHub Desktop.
<?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