Tube website not showing thumbnails

  • Unknown's avatar

    1. I created a new tube website by downloading a theme from other website.
    2. I tried uploading an embedded video from openload and setting a featured image
    3. However, I don’t see the image on the post, only the default icon which was uploaded in the theme file.
    4. Is it because of an error or I’m doing it wrong?

    I’m posting my functions.php script below:

    <?php
    // Theme Constants
    define(“THEME_PREFIX”, “wtp_”);

    // Theme Location
    define(‘THEME’, get_bloginfo(‘template_url’), true);

    add_theme_support( ‘post-thumbnails’ );

    //set_post_thumbnail_size( 100, 100, true ); // Normal post thumbnails
    //add_image_size( ‘small-post-thumbnail’, 135, 9999 ); // EVENT posts thumbnail size
    //add_image_size( ‘medium-post-thumbnail’, 274, 9999 ); // BLOG posts thumbnail size
    //add_image_size( ‘big-post-thumbnail’, 394, 9999 ); // FEATURES posts thumbnail size

    // Add RSS Feed Links
    add_theme_support( ‘automatic-feed-links’ );

    // Custom Menus
    register_nav_menu(‘main_menu’, __(‘Main Menu’));

    // unregister all default WP Widgets
    function unregister_default_wp_widgets() {
    //unregister_widget(‘WP_Widget_Calendar’);
    //unregister_widget(‘WP_Widget_Meta’);
    //unregister_widget(‘WP_Widget_Search’);
    //unregister_widget(‘WP_Widget_Tag_Cloud’);
    //unregister_widget(‘WP_Widget_RSS’);
    //unregister_widget(‘WP_Widget_Akismet’);
    }

    add_action(‘widgets_init’, ‘unregister_default_wp_widgets’, 1);

    // Feed Refresh Rate
    add_filter( ‘wp_feed_cache_transient_lifetime’, create_function(‘$a’, ‘return 1800;’) );

    // Include Custom Theme Widgets
    include(“widgets/recent-news.php”);

    // The Admin Page
    add_action(‘admin_menu’, “wtp_admin_init”);

    // Register Admin
    function wtp_admin_init()
    {
    $page = add_theme_page( “Tube Options”, “Theme Options”, 8, ‘wtp_admin_menu’, ‘wtp_admin’);
    // Custom Image Uploaders
    dc_add_img_upload_filter(THEME_PREFIX.’favicon’, ‘dc_handle_favicon_upload’);
    dc_add_img_upload_filter(THEME_PREFIX.’logo’, ‘dc_handle_logo_upload’);
    dc_add_img_upload_filter(THEME_PREFIX.’headerad_img’, ‘dc_handle_headerad_img_upload’);
    dc_add_img_upload_filter(THEME_PREFIX.’footerad_img’, ‘dc_handle_footerad_img_upload’);
    }

    // Image Upload Helper Function
    function dc_add_img_upload_filter($option_name, $handler) {
    add_filter(‘pre_update_option_’.$option_name, $handler, 10, 2);
    }

    // Image Upload Handler Functions
    function dc_handle_favicon_upload($new_value, $old_value) {
    return dc_handle_img_upload(
    $new_value,
    $old_value,
    THEME_PREFIX.’favicon_upload’,
    THEME_PREFIX.’delete_favicon’);
    }
    function dc_handle_logo_upload($new_value, $old_value) {
    return dc_handle_img_upload(
    $new_value,
    $old_value,
    THEME_PREFIX.’logo_upload’,
    THEME_PREFIX.’delete_logo’);
    }
    function dc_handle_headerad_img_upload($new_value, $old_value) {
    return dc_handle_img_upload(
    $new_value,
    $old_value,
    THEME_PREFIX.’headerad_img_upload’,
    THEME_PREFIX.’delete_headerad_img’);
    }
    function dc_handle_footerad_img_upload($new_value, $old_value) {
    return dc_handle_img_upload(
    $new_value,
    $old_value,
    THEME_PREFIX.’footerad_img_upload’,
    THEME_PREFIX.’delete_footerad_img’);
    }

    // Generic Image Upload Handler
    function dc_handle_img_upload($new_value, $old_value, $file_index, $delete_field) {
    if ( isset($_POST[$delete_field]) && $_POST[$delete_field]==’true’ )
    return ”;

    if ( empty($_FILES) || !isset($_FILES[$file_index]) || 0==$_FILES[$file_index][‘size’] )
    return $old_value;

    $overrides = array(‘test_form’ => false);
    $file = wp_handle_upload($_FILES[$file_index], $overrides);

    if ( isset($file[‘error’]) )
    wp_die( $file[‘error’] );

    $url = $file[‘url’];
    $type = $file[‘type’];
    $file = $file[‘file’];
    $filename = basename($file);

    // Construct The Object Array
    $object = array(
    ‘post_title’ => $filename,
    ‘post_content’ => $url,
    ‘post_mime_type’ => $type,
    ‘guid’ => $url
    );

    // Save The Data
    $id = wp_insert_attachment($object, $file);

    // Add The Meta
    wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );

    do_action(‘wp_create_file_in_uploads’, $file, $id); // For replication
    return esc_url($url);
    }

    add_action( ‘parse_request’, ‘my_custom_css’ );
    function my_custom_css($wp) {
    global $wpdb;
    $table_name = $wpdb->prefix . “transaction_info”;
    $my_payment_info = $wpdb->get_results(“SELECT tid, paypal_email, paypal_transaction_id FROM $table_name WHERE tid = ‘1’”);
    foreach ($my_payment_info as $wtpsettings)
    {
    $wtp_paypal_email = $wtpsettings->paypal_email;
    $wtp_transaction_info = $wtpsettings->paypal_transaction_id;
    }
    if($_SERVER[“HTTP_HOST”]!=”localhost”)
    {
    global $wpdb;
    $site_health = $wpdb->get_results(“SELECT site_status FROM “.$wpdb->prefix.”wtpconfig WHERE tid = ‘1’”);
    foreach ($site_health as $sitehealth) {
    $site_display = $sitehealth->site_status;
    }
    if($site_display==1)
    {
    echo “<div style=’color:red; margin:20px; font-weight:bold;’>Your WTP(Pro) License Has Been Terminated

    Please Contact WP-Tube-Plugin.com Support Team Immediately</div>”;
    exit;
    }
    }
    if (!empty( $_GET[‘custom-content’] ) && $_GET[‘custom-content’] == ‘css’ ) {
    header( ‘Content-Type: text/css’ );
    require dirname( __FILE__ ) . ‘/style-custom.php’;
    exit;
    }
    }

    function wtp_admin() {

    $option_fields = array();

    if ( $_GET[‘updated’] ) echo ‘<div id=”message” class=”updated fade”><p>Tube Theme Options Saved.</p></div>’;
    echo ‘<link rel=”stylesheet” href=”‘.get_bloginfo(‘template_url’).’/functions.css” type=”text/css” media=”all” />’;
    // Accordion Script
    echo ‘<link rel=”stylesheet” href=”‘.get_bloginfo(‘template_url’).’/scripts/accordion/style.css” type=”text/css” media=”all” />’;
    echo ‘<script src=”‘.get_bloginfo(‘template_url’).’/scripts/accordion/jquery.ui.js” type=”text/javascript”></script>’;
    echo ‘<script src=”‘.get_bloginfo(‘template_url’).’/scripts/accordion/jquery.accordion.js” type=”text/javascript”></script>’;

    ?>

    <div class=”wrap”>
    <div id=”icon-options-general” class=”icon32″>
    </div>

    <h2>Tube Theme Options</h2>
    <div class=”metabox-holder”>
    <form method=”post” action=”options.php” enctype=”multipart/form-data”>
    <?php wp_nonce_field(‘update-options’); ?>

    <div id=”theme-options”>
    <div id=”accordion” class=”postbox-container”>
    <?php
    include(“options/custom-menus.php”);
    include(“options/generals.php”);
    include(“options/video-player-text.php”);
    include(“options/video-player-adsense.php”);
    include(“options/header-customization.php”);
    include(“options/footer-customization.php”);
    include(“options/analytics-code.php”);
    ?>
    </div> <!– postbox-container –>
    </div> <!– theme-options –>

    <input type=”hidden” name=”action” value=”update” />
    <input type=”hidden” name=”page_options” value=”<?php echo implode(“,”, $option_fields); ?>” />
    </form>

    <script type=”text/javascript” language=”javascript”>SI.Files.stylizeAll();</script>
    </div> <!– metabox-holder –>
    </div> <!– wrap –>

    <?php
    }

    if ( function_exists(‘register_sidebar’) ) {
    register_sidebar(array(
    ‘name’ => ‘Homepage Add1’,
    ‘description’ => __(‘Homepage TOP Add (468px X 60px Approx)’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    register_sidebar(array(
    ‘name’ => ‘Homepage Add2’,
    ‘description’ => __(‘Homepage Add (Below Search Bar (1200px X 200px Approx))’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    register_sidebar(array(
    ‘name’ => ‘Left Hand Side Category Display’,
    ‘description’ => __(‘Left Hand Side Category Display’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));

    register_sidebar(array(
    ‘name’ => ‘Left Hand Side Add’,
    ‘description’ => __(‘Left Hand Side Add ( Below Category (185px X 600px Approx))’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));

    register_sidebar(array(
    ‘name’ => ‘Homepage Add (Videos Being Watched)’,
    ‘description’ => __(‘Homepage Add (Videos Being Watched (370px X 300px Approx))’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    register_sidebar(array(
    ‘name’ => ‘Homepage Add (Right Hand Side)’,
    ‘description’ => __(‘Homepage Add (Right Hand Side (185px X 600px Approx))’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    register_sidebar(array(
    ‘name’ => ‘Video Page Add’,
    ‘description’ => __(‘Video Page (Next To Video Player (500px X 600px Approx))’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    register_sidebar(array(
    ‘name’ => ‘Related Videos’,
    ‘description’ => __(‘Related Videos (185px X 600px Approx)’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    register_sidebar(array(
    ‘name’ => ‘Comments Sidebar’,
    ‘description’ => __(‘Comments Sidebar (185px X 600px Approx)’),
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    }

    function get_page_id($page_name){
    global $wpdb;
    $page_name = $wpdb->get_var(“SELECT ID FROM $wpdb->posts WHERE post_name = ‘”.$page_name.”‘ AND post_status = ‘publish’ AND post_type = ‘page’”);
    return $page_name;
    }

    function tube_get_limited_string($output, $max_char)
    {
    $output = str_replace(‘]]>’, ‘]]>’, $output);
    $output = strip_tags($output);

    if ((strlen($output)>$max_char) && ($espacio = strpos($output, ” “, $max_char )))
    {
    $output = substr($output, 0, $espacio).’…’;
    return $output;
    }
    else
    {
    return $output;
    }
    }

    function tube_getcustomfield($filedname, $page_current_id = NULL)
    {

    if($page_current_id==NULL)
    $page_current_id = get_page_id();

    $value = get_post_meta($page_current_id, $filedname, true);
    return $value;
    }

    function mytheme_comment( $comment, $args, $depth ) {
    $GLOBALS[‘comment’] = $comment;
    switch ( $comment->comment_type ) :
    case ” :
    ?>
    <li id=”li-comment-<?php comment_ID(); ?>”>

    <div <?php comment_class(); ?> id=”comment-<?php comment_ID(); ?>”>

    <div class=”reply_section”><!–reply_section–>
    <div class=”reply_lft”><!–reply_lft–>
    <?php echo get_avatar( $comment, 50 ); ?>
    </div><!–/reply_lft–>
    <div class=”reply_rgt”><!–reply_rgt–>
    <div class=”top_reply”><!–top_reply–>
    <p>By: <?php echo get_comment_author_link() ?></p>
    </div><!–/top_reply–>
    <div class=”reply_cont”>
    <?php if ( $comment->comment_approved == ‘0’ ) : ?>
    <em style=”clear:both; display:block”><?php _e( ‘Your comment is awaiting moderation.’, ‘twentyten’ ); ?>

    <?php endif; ?>
    <?php comment_text(); ?>
    </div>
    </div><!–/reply_rgt–>
    </div><!–/reply_section–>

    <?php
    break;
    case ‘pingback’ :
    case ‘trackback’ :
    ?>
    <li class=”post pingback”>
    <p><?php _e( ‘Pingback:’, ‘twentyten’ ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __(‘(Edit)’, ‘twentyten’), ‘ ‘ ); ?></p>
    <?php
    break;
    endswitch;
    }

    ?>

  • Hi there!

    There are two different versions of WordPress. These are the support forums for WordPress.com, and you have the self hosted WordPress.org version. You can read about the differences here:

    https://en.support.wordpress.com/com-vs-org/

    Try posting your question in the WordPress.org support forums, or contacting your host directly for help.

    Good luck!

  • The topic ‘Tube website not showing thumbnails’ is closed to new replies.