<channel> <title><?php echo $website_name; ?> </title> <link><?php echo $website_url; ?> </link> <description><?php echo $website_name; ?> </description> <pubDate><?php echo fn_datetimeformat('D, d M Y H:i:s +0000', get_lastmodified()); ?> </pubDate> <generator>http://jurpo.com/jurpopage</generator> <language>en</language> <? $query ="select * from note order by note_date desc LIMIT 0,5"; $result = fn_query($conn_id,$query); while($rows = fn_fetch_array($result)) { extract($rows,EXTR_OVERWRITE); $note_url=$website_url.'?note='.$note_id; ?> <item> <title><?php echo $note_title; ?>
public function get_priority($sitemap = 'post_type', $term = '') { if ('post_type' == $sitemap) { global $post; $options = $this->get_post_types(); $defaults = $this->defaults('post_types'); $priority_meta = get_metadata('post', $post->ID, '_xmlsf_priority', true); if (!empty($priority_meta) || $priority_meta == '0') { $priority = floatval(str_replace(",", ".", $priority_meta)); } elseif (!empty($options[$post->post_type]['dynamic_priority'])) { $post_modified = mysql2date('U', $post->post_modified_gmt, false); if (empty($this->lastmodified)) { $this->lastmodified = mysql2date('U', get_lastmodified('GMT', $post->post_type), false); } // last posts or page modified date in Unix seconds // uses get_lastmodified() function defined in xml-sitemap/hacks.php ! if (empty($this->firstdate)) { $this->firstdate = mysql2date('U', get_firstdate('GMT', $post->post_type), false); } // uses get_firstdate() function defined in xml-sitemap/hacks.php ! if (isset($options[$post->post_type]['priority'])) { $priority_value = floatval(str_replace(",", ".", $options[$post->post_type]['priority'])); } else { $priority_value = floatval($defaults[$post->post_type]['priority']); } // reduce by age // NOTE : home/blog page gets same treatment as sticky post if (is_sticky($post->ID) || $this->is_home($post->ID)) { $priority = $priority_value; } else { $priority = $this->lastmodified > $this->firstdate ? $priority_value - $priority_value * ($this->lastmodified - $post_modified) / ($this->lastmodified - $this->firstdate) : $priority_value; } if ($post->comment_count > 0) { $priority = $priority + 0.1 + (0.9 - $priority) * $post->comment_count / wp_count_comments($post->post_type)->approved; } } else { $priority = isset($options[$post->post_type]['priority']) && is_numeric($options[$post->post_type]['priority']) ? $options[$post->post_type]['priority'] : $defaults[$post->post_type]['priority']; } } elseif (!empty($term)) { $max_priority = 0.4; $min_priority = 0.0; // TODO make these values optional $tax_obj = get_taxonomy($term->taxonomy); $postcount = 0; foreach ($tax_obj->object_type as $post_type) { $_post_count = wp_count_posts($post_type); $postcount += $_post_count->publish; } $priority = $postcount > 0 ? $min_priority + $max_priority * $term->count / $postcount : $min_priority; } else { $priority = 0.5; } // make sure we're not below zero if ($priority < 0) { $priority = 0; } // and a final trim for cases where we ended up above 1 (sticky posts with many comments) if ($priority > 1) { $priority = 1; } return number_format($priority, 1); }
'; } } // the main query query_posts(array('post_type' => 'any', 'posts_per_page' => -1)); global $wp_query; $wp_query->is_404 = false; // force is_404() condition to false when on site without posts $wp_query->is_feed = true; // force is_feed() condition to true so WP Super Cache includes // the sitemap in its feeds cache // setup site variables $_post_count = wp_count_posts('post'); $_page_count = wp_count_posts('page'); $_totalcommentcount = wp_count_comments(); $lastmodified_gmt = get_lastmodified('GMT'); // last posts or page modified date $lastmodified = mysql2date('U', $lastmodified_gmt); // last posts or page modified date in Unix seconds $firstmodified = mysql2date('U', get_firstmodified('GMT')); // uses new get_firstmodified() function defined in xml-sitemap.php ! // calculated presets if ($_totalcommentcount->approved > 0) { $comment_weight = ($max_priority - $min_priority) / $_totalcommentcount->approved; } else { $comment_weight = 0; } if ($_post_count->publish > $_page_count->publish) { // site emphasis on posts $post_priority = 0.7; $page_priority = 0.3;
?> </lastmod> </sitemap> <?php // add rules for public post types foreach ($xmlsf->have_post_types() as $post_type) { $archive = isset($post_type['archive']) ? $post_type['archive'] : ''; foreach ($xmlsf->get_archives($post_type['name'], $archive) as $m => $url) { ?> <sitemap> <loc><?php echo $url; ?> </loc> <lastmod><?php echo mysql2date('Y-m-d\\TH:i:s+00:00', get_lastmodified('gmt', $post_type['name'], $m), false); ?> </lastmod> </sitemap> <?php } } // add rules for public taxonomies foreach ($xmlsf->get_taxonomies() as $taxonomy) { if (wp_count_terms($taxonomy, array('hide_empty' => true)) > 0) { ?> <sitemap> <loc><?php echo $xmlsf->get_index_url('taxonomy', $taxonomy); ?> </loc>