• 29-02-2016, 20:03:13
    #10
    eline sağlık hocam.
    faydalı bir bilgi.
  • 09-05-2020, 03:04:00
    #11
    Üyeliği durduruldu
    Misafir adlı üyeden alıntı: mesajı görüntüle
    Gerçi alaka görmemiş konu ama yinede birilerinin işine yarar ilerde V2

    son 50 konuya ait tüm resimleri ve attachment urlleri harita yapalım

    <?php
    include('wp-config.php');
    include('wp-load.php');
    echo '<?xml version="1.0" encoding="UTF-8"?>
     <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
            
      xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
    
    $args = array( 'numberposts' => '50' );
        $recent_posts = wp_get_recent_posts( $args );
        foreach( $recent_posts as $recent ){
        if($images = get_children(array(
            'post_parent'    => $recent["ID"],
            'post_type'      => 'attachment',
            'numberposts'    => -1,
            'post_status'    => null,
            'post_mime_type' => 'image',
        ))) {
            foreach($images as $image) {
    $atturl   = wp_get_attachment_url($image->ID);
    $attlink  = get_attachment_link($image->ID);
    echo"rn <url>rn ";
       echo"<loc>";
      echo $attlink;
       echo "</loc>rn ";  
       echo "<image:image>rn ";
         echo "<image:loc>";
         echo $atturl;
         echo "</image:loc>rn ";  
       echo "</image:image>rn ";
     echo "</url>";                
        }
    }
    }
    echo"rn </urlset>";
    ?>
    resim haritası max 1000 url içerebilir ona göre yukarıdaki 50 rakamını kendinize göre düzenleyebilirsiniz.
    bunun attachment a değil de post url sini gösteren versiyonu var mı?