Last active
September 23, 2018 18:15
-
-
Save tripflex/b6b081305c834d65eb8c5c687f9984b7 to your computer and use it in GitHub Desktop.
SoundCloud oEmbed set custom color when using WP Job Manager Field Editor
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 | |
// Example below if for meta key of "listing_soundcloud", replace "listing_soundcloud" with the meta key of field you are using | |
add_filter( 'field_editor_output_as_value_listing_soundcloud', 'smyles_add_color_to_soundcloud_url' ); | |
function smyles_add_color_to_soundcloud_url( $value ) { | |
// If empty value, or does not have soundcloud.com in value, return value without adding color | |
if( empty( $value ) || strpos( $value, 'soundcloud.com' ) === FALSE ){ | |
return $value; | |
} | |
// Set hex color below (omit #) | |
$value = add_query_arg( 'color', 'fb236a', $value ); | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment