• 14-11-2023, 18:16:23
    #10
    Onur89TR adlı üyeden alıntı: mesajı görüntüle
    function autoset_featured(){
    global $post;
    $already_has_thumb = has_post_thumbnail($post->ID);
    if (!$already_has_thumb){
    $attached_image = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1");
    if ($attached_image){
    foreach ($attached_image as $attachment_id =>$attachment){
    set_post_thumbnail($post->ID,$attachment_id);
    }
    }
    }
    }//end function
    add_action('the_post','autoset_featured');
    add_action('save_post','autoset_featured');
    add_action('draft_to_publish','autoset_featured');
    add_action('new_to_publish','autoset_featured');
    add_action('pending_to_publish','autoset_featured');
    add_action('future_to_publish','autoset_featured');
    Bu şekilde çalışması lazım
    Yok buda çalışmadı.

    https://test.selbermachendeko.com/page/28/
  • 14-11-2023, 18:25:33
    #11
    http://wordpress.org/extend/plugins/...ost-thumbnail/ eklenti ya da https://www.r10.net/1071445461-post5.html bu mesajdaki kod işinizi görür
  • 14-11-2023, 19:02:12
    #12
    dertliA adlı üyeden alıntı: mesajı görüntüle
    Hocam functions.php'ye eklenecek kodların hiçbirisi çalışmadı...
  • 14-11-2023, 19:22:46
    #13
    Onur89TR adlı üyeden alıntı: mesajı görüntüle
    Hocam functions.php'ye eklenecek kodların hiçbirisi çalışmadı...
    Temayla alakalı olabilir hocam. Eklentiyi denediniz mi
  • 14-11-2023, 19:25:16
    #14
    aşağıdaki kodu kopyalayıp resim.php olarak kaydedin.
    daha sonra resim.php dosyasını wp ana klasörünüze yükleyin (wp-config.php ile aynı dizin)
    sitenizinadi.uzanti/resim.php olarak web sayfasında linke gidin. postlardaki ilk resmi öne çıkan görsel olarak ayarlar
    Not: resimler yazılarda atachlı olmak zorunda url veya html blok içerisindeki resimleri almaz

    <?php
    // r10.net/iskendercnr
    require __DIR__ . '/wp-load.php';
    
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => -1,
    );
    
    $posts = get_posts($args);
    
    foreach ($posts as $post) {
        $post_id = $post->ID;
    
        $attachments = get_posts(array(
            'post_type' => 'attachment',
            'posts_per_page' => -1,
            'post_parent' => $post_id,
        ));
        if ($attachments) {
            set_post_thumbnail($post_id, $attachments[0]->ID);
        }
    
    }
    
    ?>
  • 14-11-2023, 19:28:59
    #15
    dertliA adlı üyeden alıntı: mesajı görüntüle
    Temayla alakalı olabilir hocam. Eklentiyi denediniz mi
    Eklenti çalıştı hocam, arşivime atıyorum. Teşekkürler
  • 14-11-2023, 19:30:27
    #16
    iskendercnr adlı üyeden alıntı: mesajı görüntüle
    aşağıdaki kodu kopyalayıp resim.php olarak kaydedin.
    daha sonra resim.php dosyasını wp ana klasörünüze yükleyin (wp-config.php ile aynı dizin)
    sitenizinadi.uzanti/resim.php olarak web sayfasında linke gidin. postlardaki ilk resmi öne çıkan görsel olarak ayarlar
    Not: resimler yazılarda atachlı olmak zorunda url veya html blok içerisindeki resimleri almaz

    <?php
    // r10.net/iskendercnr
    require __DIR__ . '/wp-load.php';
    
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => -1,
    );
    
    $posts = get_posts($args);
    
    foreach ($posts as $post) {
        $post_id = $post->ID;
    
        $attachments = get_posts(array(
            'post_type' => 'attachment',
            'posts_per_page' => -1,
            'post_parent' => $post_id,
        ));
        if ($attachments) {
            set_post_thumbnail($post_id, $attachments[0]->ID);
        }
    
    }
    
    ?>
    denedim. olmadı boş sayfa açılıyor resim.php

    https://test.selbermachendeko.com/infuse-european-charm-transform-your-home-into-a-european-retreat/
    bu şekilde post yapısında çalışmaz mı?
  • 14-11-2023, 19:33:47
    #17
    A.AY adlı üyeden alıntı: mesajı görüntüle
    denedim. olmadı boş sayfa açılıyor resim.php

    https://test.selbermachendeko.com/in...opean-retreat/
    bu şekilde çalışmaz mı?
    ana dizinde olmalı
    https://test.selbermachendeko.com/resim.php
    şeklinde

    ayrıca boş çıkması normal çıktı yazmadım

    postlarınızı panelden kontrol edin ve mümkünse 1-2-3 diye düşük numaralı post id lerinizi kontrol edin

    sunucunuzda zaman aşımı az ayarlıysa bütün postları yapmamış olabilir
  • 14-11-2023, 19:35:44
    #18
    iskendercnr adlı üyeden alıntı: mesajı görüntüle
    ana dizinde olmalı
    https://test.selbermachendeko.com/resim.php
    şeklinde

    ayrıca boş çıkması normal çıktı yazmadım

    postlarınızı panelden kontrol edin ve mümkünse 1-2-3 diye düşük numaralı post id lerinizi kontrol edin

    sunucunuzda zaman aşımı az ayarlıysa bütün postları yapmamış olabilir
    baktım id 1 2 3 şeklinde postlarda da çalışmadı
    https://test.selbermachendeko.com/hello-world/
    id 1 post

    https://test.selbermachendeko.com/page/28/
    ilk postlar