Last active
August 29, 2015 14:13
Revisions
-
magnificode renamed this gist
Jan 21, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
magnificode created this gist
Jan 21, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ <?php $ctaLink = get_field('static_hero_cta_button_link'); if (false !== strpos($ctaLink,'attachment_id')) { $url = $ctaLink; $url_parsed = parse_url($url); parse_str($url_parsed['query'], $url_parts); $attachmentID = $url_parts['attachment_id']; // attachment ID $attachmentSrc = wp_get_attachment_url( $attachmentID ); // returns an array $ctaLink = $attachmentSrc; } ?>