• 14-07-2013, 15:19:17
    #1
    Özel alana resim yüklenmediği takdirde varsayılan bir resim atamak istiyorum. Aşağıdaki kodda nasıl bir değişiklik yapmak gerekir?

    <img src="<?php echo get_post_meta($post->ID, 'Thumbnail',true) ?>" width="650" height="315" >
  • 14-07-2013, 15:46:37
    #2
    <img src="<?php $thumbnailresim = get_post_meta($post->ID, 'Thumbnail',true); if ($thumbnailresim ) echo $thumbnailresim; else echo 'http://www.siteadi.com/wp-content/uploads/resimyok.jpg'; ?>" width="650" height="315" >
    Şeklinde değiştirip, kullabilirsiniz. Kod içerisindeki resim adresini kendi sitenizde kullanmak istediğini resimyok resminin adresiyle değiştirin.
  • 14-07-2013, 17:09:20
    #3
    yakuphan adlı üyeden alıntı: mesajı görüntüle
    <img src="<?php $thumbnailresim = get_post_meta($post->ID, 'Thumbnail',true); if ($thumbnailresim ) echo $thumbnailresim; else echo 'http://www.siteadi.com/wp-content/uploads/resimyok.jpg'; ?>" width="650" height="315" >
    Şeklinde değiştirip, kullabilirsiniz. Kod içerisindeki resim adresini kendi sitenizde kullanmak istediğini resimyok resminin adresiyle değiştirin.
    Teşekkürler, oldu.
  • 28-10-2013, 18:08:57
    #4
    Yeniden başıma böyle bir durum geldi, beceremedim.

    Şu kodlara varsayılanı resmi nasıl yerleştirebiliriz?

    Alıntı
    <h1><?php the_title();?></h1>
    <?php $resim = get_post_meta($post->ID,'resim', true); if($resim != "") { ?>
    <img class="alignleft" src="<? echo ($resim); ?>" width="615" height="315" alt="<?php the_title(); ?>" /></a>
    <?php }else{ ?>
    <?php } ?>
  • 28-10-2013, 19:11:00
    #5
    zanaatkar adlı üyeden alıntı: mesajı görüntüle
    Yeniden başıma böyle bir durum geldi, beceremedim.
    <h1><?php the_title();?></h1>
    <?php $resim = get_post_meta($post->ID,'resim', true); if($resim != "") { ?>
    <img class="alignleft" src="<? echo ($resim); ?>" width="615" height="315" alt="<?php the_title(); ?>" /></a>
    <?php }else{ ?>
    <?php } ?>
    Şu kodlara varsayılanı resmi nasıl yerleştirebiliriz?
    "<?" yerine "<?php" kullanın. ayrıca "echo ($resim)" şeklinde bir kullanım yok php'de

    <h1><?php the_title() ?></h1>
    <?php $resim = get_post_meta($post->ID, 'resim', true);
     if($resim) : ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title() ?><img class="alignleft" src="<?php echo $resim ?>" width="615" height="315" alt="<?php the_title() ?>" /></a>
    <?php else : ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title() ?><img class="alignleft" src="resim-urlsi-buraya" width="615" height="315" alt="<?php the_title() ?>" /></a>
    <?php endif; ?>
    umarım işini görür.
  • 28-10-2013, 19:18:09
    #6
    ruinded adlı üyeden alıntı: mesajı görüntüle
    "<?" yerine "<?php" kullanın. ayrıca "echo ($resim)" şeklinde bir kullanım yok php'de

    <h1><?php the_title() ?></h1>
    <?php $resim = get_post_meta($post->ID, 'resim', true);
     if($resim) : ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title() ?><img class="alignleft" src="<?php echo $resim ?>" width="615" height="315" alt="<?php the_title() ?>" /></a>
    <?php else : ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title() ?><img class="alignleft" src="resim-urlsi-buraya" width="615" height="315" alt="<?php the_title() ?>" /></a>
    <?php endif; ?>
    umarım işini görür.
    İlk dediğinle alakalı olarak pek bilgim yok, her ikisi de çalışıyor.

    Fakat kod çalışmadı.
  • 06-11-2013, 22:40:59
    #7
    zanaatkar adlı üyeden alıntı: mesajı görüntüle
    İlk dediğinle alakalı olarak pek bilgim yok, her ikisi de çalışıyor.

    Fakat kod çalışmadı.
    <h1><?php the_title(); ?></h1>
    <?php $resim = get_post_meta($post->ID, 'resim', true);
     if($resim) : ?>
    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?><img class="alignleft" src="<?php echo $resim; ?>" width="615" height="315" alt="<?php the_title(); ?>" /></a>
    <?php else : ?>
    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?><img class="alignleft" src="resim-urlsi-buraya" width="615" height="315" alt="<?php the_title(); ?>" /></a>
    <?php endif; ?>
    Bi de bunu denesene hocam
  • 06-11-2013, 23:27:37
    #8
    ruinded adlı üyeden alıntı: mesajı görüntüle
    <h1><?php the_title(); ?></h1>
    <?php $resim = get_post_meta($post->ID, 'resim', true);
     if($resim) : ?>
    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?><img class="alignleft" src="<?php echo $resim; ?>" width="615" height="315" alt="<?php the_title(); ?>" /></a>
    <?php else : ?>
    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?><img class="alignleft" src="resim-urlsi-buraya" width="615" height="315" alt="<?php the_title(); ?>" /></a>
    <?php endif; ?>
    Bi de bunu denesene hocam
    Olmadı hocam.