WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content Type Manager
Automatic insert custom field content into YouTube embed code (2 posts)

  1. bswb97
    Member
    Posted 1 year ago #

    How can I edit my code so that my custom field is the ID code of a YouTube video (e.g. s6jaYJx7yeI) and it is automatically output as an embedded video.

    That is, the custom field is automatically inserted into here:

    <iframe width="420" height="315" src="http://www.youtube.com/embed/CUSTOMFIELDVALUEHERE" frameborder="0" allowfullscreen></iframe>

    All of the different things I've tried with custom field either kill the iframe callout or block off the code at /embed. I can't seem to get it neatly inserted into the source callout. Help!

    http://wordpress.org/extend/plugins/custom-content-type-manager/

  2. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    I would use the wrapper output filter (see examples here http://code.google.com/p/wordpress-custom-content-type-manager/wiki/wrapper_OutputFilter):

    In your single-xxxxx.php template file:
    <?php print_custom_field('your_field:wrapper', '<iframe width="420" height="315" src="http://www.youtube.com/embed/[+content+]" frameborder="0" allowfullscreen></iframe>'); ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic