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"\r\n <url>\r\n ";
echo"<loc>";
echo $attlink;
echo "</loc>\r\n ";
echo "<image:image>\r\n ";
echo "<image:loc>";
echo $atturl;
echo "</image:loc>\r\n ";
echo "</image:image>\r\n ";
echo "</url>";
}
}
}
echo"\r\n </urlset>";
?>
resim haritası max 1000 url içerebilir ona göre yukarıdaki 50 rakamını kendinize göre düzenleyebilirsiniz.
Hocam kodlar bozuk çıkmıs rica etsem düzgün halini koyabilir misiniz?