How to parse multiple links from one variable?

Question

So I have a Pod set up as a shortcode where it outputs the links for files a user uploads. Here is the following shortcode I made (imagine my shortcode being [getShortCode field="upload_files"]:

function pods_current_user($atts) {
   extract(shortcode_atts(array(
      'currUser' => get_current_user_id(),
   ), $atts)); 
   extract(shortcode_atts(array(
    'field' => "display_name",
 ), $atts)); 
    $message = do_shortcode('[pods name="user" where="ID = '.$currUser.'"] {@'.$field.'}[/pods]');
    return $message;
 }
add_shortcode('getShortCode', 'pods_current_user'); 

At the moment what it outputs is a set of links to the uploaded files, but as a plain text, not hyperlinked. Something like the following:

http://secureservercdn.net/196.71.233.106/7ho.fa0.myftpupload.com/wp-content/uploads/2019/11/Screnshot-5.png?time=1575937207 http://secureservercdn.net/196.71.233.106/7ho.fa0.myftpupload.com/wp-content/uploads/2069/11/Geting-started-with-OneDrive-1.pdf?time=1675037207

(without the hyperlinks). Is there a way to be able to separate the links from my one variable into a scalable array, right in the function for my shortcode? Like maybe detect where the http is and separate the links like that? Thanks.

0
, Ali Mosallaei 4 years 2019-11-29T16:43:34-05:00 0 Answers 76 views 0

Leave an answer

Browse
Browse