Full HD बिना Plugin के Sitemap कैसे बनाए ?

HD Video of बिना Plugin के Sitemap कैसे बनाए ? on e akhabaar

वेबसाईट के uploaded content को proper सर्च इंजन मे index करने के लिए साइटमैप का होना बहुत जरूरी है ।

यदि आप वॉर्डप्रेसस के यूजर हैं और आप चाहते है की अपने वेबसाईट मे sitemap.xml फाइल बना कर अपने वॉर्डप्रेसस मे upload कर दें तो आप ऐसा कर सकते है । उसके लिए आप नीचे दिए step को follow करते जाइए –

1 – function.php

आप नीचे दिए हुए कोड को function.php मे patse कर दीजिए

function xml_sitemap() 
$postsForSitemap = get_posts(array(
'numberposts' => -1,
'orderby' => 'modified',
'post_type' => array('post','page'),
'order' => 'DESC'
));

$sitemap = '';
$sitemap .= '';

foreach($postsForSitemap as $post) 
setup_postdata($post);

$sitemap .= ''.
''. get_permalink($post->ID) .''.
'';


$sitemap .= '';

$fp = fopen(ABSPATH . "sitemap.xml", 'w');
fwrite($fp, $sitemap);
fclose($fp);


add_action("publish_post", "xml_sitemap");
add_action("publish_page", "xml_sitemap");
?>

या

function xml_sitemap() 
$postsForSitemap = get_posts(array(
'numberposts' => -1,
'orderby' => 'modified',
'post_type' => array('post','page'),
'order' => 'DESC'
));

$sitemap = '';
$sitemap .= '';

foreach($postsForSitemap as $post) 
setup_postdata($post);

$sitemap .= ''.
''. get_permalink($post->ID) .''.
'';


$sitemap .= '';

$fp = fopen(ABSPATH . "sitemap.xml", 'w');
fwrite($fp, $sitemap);
fclose($fp);


add_action("publish_post", "xml_sitemap");
add_action("publish_page", "xml_sitemap");
?>

इस तरह से आप बिना plugins के अपने website मे sitemap.xml create कर सकते है ।

Give your review about बिना Plugin के Sitemap कैसे बनाए ? in Comments below