Allowing the SoundCloud player to appear in a post excerpt

I am setting up a website for my music, in conjunction with my SoundCloud account. I plan to post the links to my soundcloud player as blog posts, but I can’t figure out how to make the blog excerpts show the player.

Check out the top post on the site for my example:
http://jonathanperos.com/

Read More

I want the post excerpt for “Honeycomb Rainbow” show the player for it.

Related posts

1 comment

  1. The excerpt will only fetch the text, triming tags. You need to make a new custom field (you can use Advanced Custom Fields) for the ID of that iframe. Then, you need to edit your content_excerpt.php (I don’t know wich theme are using) and fetch that field instead or below your excerpt.

    For example: (using Advanced Custom field and Twenty Thirteen theme)

    <?php 
    // fetch my custom field call it "player"
    $player = get_field('player');
    ?>
    <article id="post-<?php the_ID(); ?>">
      <div class="entry-summary">
        <h3 class="entry-title">
       <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
    </h3>
        <?php the_excerpt(); ?>
        <iframe src="https://w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/<?php echo $player;?>&show_artwork=true&maxwidth=620&maxheight=930&wmode=transparent"></iframe>
      </div>
    </article>
    

    Hope you understand my english 😀

Comments are closed.