• 20-09-2015, 13:27:53
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Arkadaşlar ben istiyorum ki resim bulunmayan bütün yazılara tek bir resmi thumbnail olarak eklesin. Kullandığım temada kodlara baktığımda bunun olması gerekiyor ama olmuyor

    Functions`da bulunan kodlar:
    
    
    ////////////////////////////////////////////////////////////////////////////////
    // get featured images
    ////////////////////////////////////////////////////////////////////////////////
    if( !function_exists( 'get_featured_post_image' )):
    function get_featured_post_image($before,$after,$width,$height,$class,$size,$alt,$title,$default) { //$size - full, large, medium, thumbnail
    global $blog_id,$wpdb, $post, $posts;
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id,$size);
    $image_url = $image_url[0];
    $current_theme = wp_get_theme();
    
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    
    if( isset($matches[1][0] ) ):
    $first_img = $matches[1][0];
    endif;
    
    if( has_post_thumbnail( $post->ID ) ) {
    
    return $before . "<img width='" . $width . "' height='". $height . "' class='" . $class . "' src='" . $image_url . "' alt='" . $alt . "' title='" . $title . "' />" . $after;
    
    } else {
    
    if($first_img) {
    return $before . "<img width='" . $width . "' height='". $height . "' class='" . $class . "' src='" . $first_img . "' alt='" . $alt . "' title='" . $title . "' />" . $after;
    } else {
    
    if($default == 'true'):
    return $before . "<img width='" . $width . "' height='". $height . "' class='" . $class . "' src='" . get_template_directory_uri() . '/images/post-default.jpg' . "' alt='" . $alt . "' title='" . $title . "' />" . $after;
    endif;
    
    }
    
    }
    
    }
    endif;
    
    
    
    
    ////////////////////////////////////////////////////////////////////////////////
    // get featured images
    ////////////////////////////////////////////////////////////////////////////////
    if( !function_exists( 'get_featured_post_image_src' )):
    function get_featured_post_image_src($before,$after,$size,$default) { //$size - full, large, medium, thumbnail
    global $blog_id,$wpdb, $post, $posts;
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id,$size);
    $image_url = $image_url[0];
    
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    
    if( isset($matches[1][0] ) ):
    $first_img = $matches[1][0];
    endif;
    
    if( has_post_thumbnail( $post->ID ) ) {
    
    return $before  . $image_url . $after;
    
    } else {
    
    if($first_img) {
    return $before . $first_img . $after;
    } else {
    
    if($default == 'true'):
    return $before  . get_template_directory_uri() . '/images/post-default.jpg' . $after;
    endif;
    
    }
    
    }
    
    }
    endif;
    
    
    if( !function_exists( 'get_post_id_outside_loop' )):


    İndex`de bulunan kod:
    ////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    
    <?php echo get_featured_post_image("<div class='post-thumb'>".$thepostlink, "</a></div>", 100, 100, "alignnone", 'thumbnail', mp_get_image_alt_text(),the_title_attribute('echo=0'), false); ?>
    
    ////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////

    arkadaşlar 3 gündür sorunu çözemedim lütfen yardımcı olun.
  • 20-09-2015, 13:29:33
    #2
    Yeşil SEO İnt. Hiz.
    Elinize sağlık hocam.
    Şu eklenti de aynı işe yarıyor sanırsam.
    https://wordpress.org/plugins/auto-post-thumbnail/

    Sizinkisi eklentisiz olmuş, daha güzel...
  • 20-09-2015, 13:34:14
    #3
    staticiation adlı üyeden alıntı: mesajı görüntüle
    Elinize sağlık hocam.
    Şu eklenti de aynı işe yarıyor sanırsam.
    https://wordpress.org/plugins/auto-post-thumbnail/

    Sizinkisi eklentisiz olmuş, daha güzel...
    Hocam yeterince eklenti kurulu sitede işin aslına bakarsan sıfır eklenti istiyorum sitemde.