Tag «Read More»

This topic contains 5 replies, has 3 voices, and was last updated by  Constantin 2 years, 7 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #262

    serj1983
    Participant

    How to add a tag «Read More» () between video and description?
    Using theme: Twenty Twelve

    #271

    Constantin
    Keymaster

    You could try something like this (please note that this will work only for newly imported videos). Enter the code below in your theme functions.php file:

    /**
     * Filter the post content on new video insert
     */
    function twentythirteen_cbc_video_content( $post_content, $video, $theme_import ){
    	// check if importing in theme
    	if( !$theme_import ){
    		return $post_content;
    	}
    	
    	// we want to add the video link to post content at the beginning
    	$video_url = 'http://www.youtube.com/watch?v='.$video['video_id'];
    	
    	return $video_url."\n" . make_clickable($post_content);
    }
    add_filter('cbc_video_post_content', 'twentythirteen_cbc_video_content', 10, 3);
    
    #276

    serj1983
    Participant

    Thanks.
    Correct:

    return $video_url."\n" . make_clickable($post_content);

    Another problem. Not apply plugin styles (or settings) YouTube to the theme.

    Example:
    http://ipic.lv/i4/acf6bf4e/c834426fcda24ee.jpg
    http://ipic.lv/i1/777f17dd/ffdb1bf1041f532.jpg
    http://ipic.lv/i4/782b9138/08b4931b43c9395.jpg

    My themes function.php

    function twentytwelve_theme_compat( $themes ){
    $themes['twenty twelve'] = array(
    'post_type' => 'post',
    'taxonomy' => false,
    'post_meta' => array(
    'embed' => 'video_embed_value'
    ),
    'post_format' => 'video',
    'theme_name' => 'Twenty Twelve'
    );
    return $themes;
    }
    add_filter('cbc_youtube_theme_support', 'twentytwelve_theme_compat');

    function twentytwelve_post_fields( $post_id, $video, $theme_import ){

    if( !$theme_import ){
    return;
    }
    if( !function_exists('cbc_get_player_settings') ){
    return;
    }

    $player_settings = cbc_get_player_settings();

    update_post_meta( $post_id, 'video_width_value', $player_settings['width'] );
    update_post_meta($post_id, 'is_video_value', true);

    }

    add_action('cbc_post_insert', 'twentytwelve_post_fields', 10, 3);

    function twentytwelve_cbc_video_content( $post_content, $video, $theme_import ){

    if( !$theme_import ){
    return $post_content;
    }

    $video_url = 'http://www.youtube.com/watch?v='.$video['video_id'];

    return $video_url."\n" . make_clickable($post_content);
    }

    add_filter('cbc_video_post_content', 'twentytwelve_cbc_video_content', 10, 3);

    #277

    Constantin
    Keymaster

    I see you’re importing as normal post type. From your second print screen I see the iframe has all settings but not in front-end. Unfortunately, this is happening based on something other than the plugin, the only thing the plugin does when importing is to put all details on the according custom fields, whatever happends after that isn’t managed by it.

    #397

    geoworldmedia
    Participant

    Hi, Is there any way that the Tags from the YouTube videos also directly are imported when you do a bulk import? I have tested importing a playlist, but the tags are not imported, they are blank.

    So this means, I need to manually add tags to the posts now?

    #398

    Constantin
    Keymaster

    Hi,

    Sorry for the delay, had some personal issues to take care of during the last weeks. Regarding YouTube tags importing, I’m sorry but YouTube API doesn’t return them when a video playlist query is made so there’s nothing to import.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.