Support » Fixing WordPress » Extract url from the post

  • I have blog post in wordpress for audio podcast like

    [audio mp3=""][/audio]
    We talk the latest with forward guidance in the Federal Reserve with Wall Street Journal reporter, Jon Hilsenrath.

    want to make a download link also for the above mp3 url inside the loop.

    How to extract the url from the above content?

    I tried like the below but it is not working

    <div class="banner-text">
    <h1><a href="<?php the_permalink(); ?>"><?php echo the_title(); ?></a></h1>
    <?php the_content(); ?>
    $content = get_the_content( $more_link_text, $stripteaser );
    preg_match_all('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $content, $match);
    $match = $match[0];
    <div class="banner-download"><a href="<?php echo $match; ?>"><span class="displace">Download</span></a></div>

    Any help ?

  • The topic ‘Extract url from the post’ is closed to new replies.