WordPress.org

Ready to get started?Download WordPress

Forums

Extract url from the post (1 post)

  1. ParamasivanPN
    Member
    Posted 11 months ago #

    I have blog post in wordpress for audio podcast like

    [audio mp3="http://www.andrewbusch.com/wp-content/uploads/show_6195505.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(); ?>
    <?php
    $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>
    </div>

    Any help ?

Reply

You must log in to post.

About this Topic