• Resolved lefian

    (@lefian)


    Hello!

    First of all, great plugin, helped me save countless hours of manual labor ??

    Two quick questions:

    – Is it possible to import videos without the description and instead add the video Youtube URL? I tried playing around with the tube_vc_filter_content_import example code, but I am unable to find the parameter for the URL.

    – How can I set the default post to be video? The post type is set to video under my general wordpress setting.

    Many thanks!

    Regards,
    Daniel

    • This topic was modified 6 years, 8 months ago by lefian.
Viewing 13 replies - 1 through 13 (of 13 total)
  • This should do the trick.

    Drop in child theme functions file or simple plugin…

    add_action('added_post_meta', 'mytube_add_video_url_to_content', 10, 4);
    
    function mytube_add_video_url_to_content( $meta_id, $post_id, $meta_key='', $meta_value='' ){
           
      // do nothing unless correct key
      if ( $meta_key != 'tube_video_oembed_url' ) return;
    
      // set up the update values
      $the_update = array(
          'ID'           => $post_id,
          'post_content' => $meta_value,
      );
    
      // Update the post into the database
      wp_update_post( $the_update );
    
    }
    Thread Starter lefian

    (@lefian)

    Thanks for the help, worked like a charm!

    Any ideas about setting the default post type? Even though I have it as video under the general WordPress setting, it still does not get posted as a video.

    Regards,
    Daniel

    Go into the plugin’s import settings page.

    /wp-admin/admin.php?page=tube-video-curator-settings&tab=import

    There’s a post type selector there.

    Sorry for skipping over that question on the previous reply.

    Thread Starter lefian

    (@lefian)

    Sorry for the late reply, got overwhelmed with work.

    Not sure if I am missing something since I do not have any options, there is only one default post type set in stone (Post). The posting works fine because whenever there is new content on the channel it creates a post, but not with the video format.

    Many thanks!
    Daniel

    If you had more than one “valid” post type for use with the plug-in, that setting would show as a drop down instead of set in stone (great choice of words BTW).

    If memory serves, the only reason a post type would not be valid is if it does not have “thumbnail support.”

    Can you please confirm that your “Video” post type does have thumbnail support?

    Thread Starter lefian

    (@lefian)

    I just checked and I do have video thumbnails in the posts that get generated (if this is what you mean?). The only downside is that right now I have to manually set each post to video for it to work properly with the theme that I am using.

    The general wordpress post creation works fine, its set to video by default and if I add a new post its set straight to video.

    To confirm…

    1) Do you have a ‘public’ custom post type that’s called “Video” or similar?

    2) If so, on that post type, is ‘supports’ set for ‘thumbnail’?

    If yes to both, you should see a dropdown in the import settings page for post type, where you could select this custom post type.

    Here’s the code that determines importable post types…

      // Returns an array of post types that can accept video imports
      
      function get_importable_post_types(){
            
        // get all public post types
        $post_types = get_post_types( array('public'   => true), 'objects' );
        
        // container for importable types
        $importable_post_types = array();
        
        // loop through the types
        foreach ($post_types as $type):
           
          // ensure thumbnail support
          if( ! post_type_supports( $type->name, 'thumbnail' ) ):
            continue;
          endif;
          
          // ignore pages, attachments, and skipped videos         
          if( $type->name === 'page' || $type->name === 'attachment' ):
            continue;
          endif;              
          
          // add the type and name to importable post types     
          $importable_post_types[$type->name] = $type->labels->singular_name;
         
        endforeach;
        
        // make sure there were importable types
        if ( count($importable_post_types) == 0 ):
         return NULL;
        endif;
         
        // return the importable types
        return $importable_post_types;
     
      }
    Thread Starter lefian

    (@lefian)

    Just looked around the codes (theme’s function.php, posts.php and tube-video-curator.php) and I did not come across that code snippet you copied and neither do I see anything relating to custom post types being defined.

    Technically speaking, if I define a custom category then I should have a listbox appear?

    Thread Starter lefian

    (@lefian)

    Added a custom post type and it appeared under the import tab.

    Quick update: Even with the custom post category, the default post format isn’t video.
    Now I am slightly confused as to why I can’t get it to create posts with a video format.

    • This reply was modified 6 years, 8 months ago by lefian. Reason: update

    Okay, you are mixing up / failing to clarify terms and I think that’s at the heart of the confusion.

    Post Type
    – Defaults are post and page
    – I thought you added a custom one called video

    Category
    – This has to do with taxonomies, not post types, and don’t think is what you’re referring to

    Post Format
    – This is a sub-function of some but not all post types and is NOT really used by the plugin out of the box

    What I think you are really asking…

    – How do I import to the default “post” post type, but set the post_format to “video” format?

    Is that correct?

    Thread Starter lefian

    (@lefian)

    Yes, that is exactly right. Sorry for the confusion, still have to get my head wrapped around the general wordpress layout.

    Ideally, I would like the plugin to do this automatically without having to manually edit each post or use some kind of additional plugin to bulk edit each post’s format.

    Drop this in a child theme functions.php or a plugin…

    
    add_filter( 'tube_vc_filter_post_pre_insert', 'my_tube_vc_filter_post_pre_insert', 10, 1 );
    
    function my_tube_vc_filter_post_pre_insert( $my_post ){
    
      $my_post['tax_input'] = array('post_format' => 'video');
    
      return $my_post;
    
    }
    

    Please mark as resolved if that works for you.

    Thread Starter lefian

    (@lefian)

    Just tested the code and it works great. Thanks a million for taking the time to help me out!

    Regards,
    Daniel

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘No video description?’ is closed to new replies.