• 19-09-2019, 14:22:24
    #1
    Arkadaşlar son eklediğim yazının sadece resim linki basmak istiyorum nasıl yaparım?

    yazdığım kondun ekranda çıktısı şöyle olsun istiyorum: https://site.com/resim.jpg yani hiç bir stil etiketi olmadan sadece resim url si basmak istiyorum.
  • 19-09-2019, 14:28:48
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Loop içinde şöyle bir şey kullanırsan direkt URL e ulaşabilirsin.

    <?php
    $image_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
    echo $feat_image;
    ?>
  • 19-09-2019, 14:40:23
    #3
    genxer34 adlı üyeden alıntı: mesajı görüntüle
    Loop içinde şöyle bir şey kullanırsan direkt URL e ulaşabilirsin.

    <?php
     $image_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
     echo $feat_image;
     ?>
    <?php query_posts('showposts=4'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_post_thumbnail('breaknews-misc-thumb3'); ?>
    <?php endwhile;?>

    kodum bu hocam ama bu <img tagları class lar falan da ekliyor ben sadece url istiyorum. Nasıl yapabilirim? Sizin kodu koydum boş bastı.
  • 19-09-2019, 14:51:56
    #4
    Peki senin kodunun dışına şunu ekler misin?

    <?php
    $latest_post = get_posts("post_type=post&numberposts=1");
    echo $latest_post[0]->ID
    
    ?>
  • 19-09-2019, 15:16:49
    #5
    https://developer.wordpress.org/refe...thumbnail_url/

    Buradaki örneklere bakmanızı öneririm.
  • 19-09-2019, 21:54:27
    #6
    genxer34 adlı üyeden alıntı: mesajı görüntüle
    Peki senin kodunun dışına şunu ekler misin?

    <?php
    $latest_post = get_posts("post_type=post&numberposts=1");
    echo $latest_post[0]->ID
    
    ?>
    resmin sadece id sini bastı bu hocam



    Onur89TR adlı üyeden alıntı: mesajı görüntüle
    https://developer.wordpress.org/refe...thumbnail_url/

    Buradaki örneklere bakmanızı öneririm.
    baktım bulamadım hocam
  • 19-09-2019, 22:33:18
    #7
    ID'si çalıştıysa şöyle birleştirelim öyleyse

    <?php
    //Son post'un ID'sine ulaşalım
    $latest_post = get_posts("post_type=post&numberposts=1");
    
    $image_url = wp_get_attachment_url( get_post_thumbnail_id($latest_post[0]->ID));
    echo $image_url;
    ?>