apgnsm_autobuild

Auto Build sitemap.

Description

apgnsm_autobuild( $postID ); 

Parameters (1)

0. $postid
The postID.

Usage

  1. if ( !function_exists( 'apgnsm_autobuild' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-news-sitemap/apgnsm.php'; 
  3.  
  4. // The postID. 
  5. $postid = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = apgnsm_autobuild($postid); 
  9.  

Defined (1)

The function is defined in the following location(s).

/apgnsm.php  
  1. function apgnsm_autobuild($postID) { 
  2. global $wp_version; 
  3. $isScheduled = false; 
  4. $lastPostID = 0; 
  5. //Ricostruisce la sitemap una volta per post se non fa import 
  6. if($lastPostID != $postID && (!defined('WP_IMPORTING') || WP_IMPORTING != true)) { 
  7.  
  8. //Costruisce la sitemap direttamente oppure fa un cron 
  9. if(floatval($wp_version) >= 2.1) { 
  10. if(!$isScheduled) { 
  11. //Ogni 15 secondi. 
  12. //Pulisce tutti gli hooks. 
  13. wp_clear_scheduled_hook(apgnsm_generate_sitemap()); 
  14. wp_schedule_single_event(time()+15, apgnsm_generate_sitemap()); 
  15. // Elliot Fix for scheduled posts 
  16. wp_clear_scheduled_hook('apgnsm_scheduled'); 
  17. wp_schedule_single_event(time()+15, 'apgnsm_scheduled'); 
  18. $isScheduled = true; 
  19. } else { 
  20. //Costruisce la sitemap una volta sola e mai in bulk mode 
  21. if(!$lastPostID && (!isset($_GET["delete"]) || count((array) $_GET['delete'])<=0)) { 
  22. $lastPostID = $postID;