Support » Plugins and Hacks » Video Thumbnails » [Resolved] [Plugin: Video Thumbnails] Scan whole post instead of "the_content"

[Resolved] [Plugin: Video Thumbnails] Scan whole post instead of "the_content"

  • Well, I’ve done some heavy coding on my wordpress blog and I’ve managed to place my YouTube embed code outside of “<?php the_content(); ?>”.
    I’ve created a custom taxonomy to place the Youtube video id in the embed code using shortcodes for easier back-end use.

    My question, is there a way to scan outside of “<?php the_content(); ?>”?
    Is it possible to scan a div within the post? that way I can put the embed video inside a div and have the plugin scan that div on every post I make.

    I believe this is the code I need to modify scanning “the_content”:

    $post_array = get_post( $post_id );
    $markup = $post_array->post_content;
    $markup = apply_filters( ‘the_content’, $markup );

    thanks for your help 😀


Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Sutherland Boswell


    Can you try to explain how you’re embedding videos more clearly? Are you using a custom field containing the YouTube ID?

    @sutherland Boswell

    I’m not using a custom field, I’m using a custom post type.

    for examply:
    I’ve placed the embed code before <?php the_content(); ?>
    my code looks like thiis:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="section-header">
    		<h1 class="section-title"><?php the_title(); ?></h1>
    <iframe width="680" height="383" src="http://www.youtube.com/embed/<?php echo do_shortcode('[youtube][/youtube]'); ?>?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
    		<?php the_content(); ?>
    </article><!-- #post-<?php the_ID(); ?> -->

    “[youtube][/youtube]” is the shortcode I use to insert the id of the video.

    Plugin Author Sutherland Boswell


    How are you inserting the ID into the shortcode? It sounds like there may be a simpler way to code what you’re trying to do.

    @sutherland Boswell

    to sum it all up, I made it to where i don’t have to keep copying and pasting the embed code of the video. so it’s already coded into the post outside of the content area. That isn’t important, I just want to find a way to scan the entire post (maybe a div within the post) instead of scanning the content area of the post..

    Plugin Author Sutherland Boswell


    The plugin interacts with the data for each post using the database, not scanning the actual HTML end result of each template. So how are you saving the YouTube ID into the WordPress database?

    @sutherland Boswell

    Oh, That makes much more sense.
    I’m entering the YouTube ID alone into a Taxonomy I created called ‘youtubecode’ so I’m assuming I’d have to get the plugin to scan that table entry for the post?

    Plugin Author Sutherland Boswell


    In the settings of the plugin select your custom post type and set the custom field to ‘youtubecode’.

    Since you’re only storing the YouTube ID in that field, you’ll have to modify the plugin to know it’s for YouTube. Change this:

    if ( $video_key = get_option( 'video_thumbnails_custom_field' ) ) {
    	$markup = get_post_meta( $post_id, $video_key, true );
    } else {


    if ( $video_key = get_option( 'video_thumbnails_custom_field' ) ) {
    	$markup = 'http://www.youtube.com/watch?v=' . get_post_meta( $post_id, $video_key, true );
    } else {
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] [Plugin: Video Thumbnails] Scan whole post instead of "the_content"’ is closed to new replies.
Skip to toolbar