Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active September 23, 2018 18:15
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 tripflex/b6b081305c834d65eb8c5c687f9984b7 to your computer and use it in GitHub Desktop.
Save tripflex/b6b081305c834d65eb8c5c687f9984b7 to your computer and use it in GitHub Desktop.
SoundCloud oEmbed set custom color when using WP Job Manager Field Editor
<?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