XML Sitemap & Google News feeds - Version 3.6.1

Version Description

  • BUGFIX: wrong date calculation on blogs less than 1 year old
Download this release

Release Info

Developer RavanH
Plugin Icon 128x128 XML Sitemap & Google News feeds
Version 3.6.1
Comparing to
See all releases

Code changes from version 3.6 to 3.6.1

Files changed (3) hide show
  1. feed-sitemap.php +14 -12
  2. readme.txt +4 -1
  3. xml-sitemap.php +2 -2
feed-sitemap.php CHANGED
@@ -14,18 +14,20 @@ $age_weight = 0.1;
14
$level_weight = 0.1;
15
16
// site variables
17
- $post_count = wp_count_posts('post');
18
- $page_count = wp_count_posts('page');
19
- $totalcommentcount = wp_count_comments();
20
- $lastpostmodified = get_lastpostmodified('GMT');
21
- $firstpostmodified = get_firstpostmodified('GMT'); // function defined in xml-sitemap.php !
22
- $average_commentcount = $totalcommentcount/($post_count->publish + $page_count->publish);
23
24
// calculated presets
25
- if ($totalcommentcount->approved > 0)
26
- $comment_weight = ($max_priority - $min_priority) / $totalcommentcount->approved;
27
28
- if ($post_count->publish > $page_count->publish) { // site emphasis on posts
29
$post_priority = 0.7;
30
$page_priority = 0.4;
31
} else { // site emphasis on pages
@@ -60,7 +62,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?>
60
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
61
<url>
62
<loc><?php bloginfo_rss('url') ?>/</loc>
63
- <lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $lastpostmodified, false); ?></lastmod>
64
<changefreq>daily</changefreq>
65
<priority>1.0</priority>
66
</url>
@@ -85,7 +87,7 @@ while ( have_posts() ) : the_post();
85
$offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (count($ancestors) * $level_weight);
86
$priority = $page_priority + round($offset,1);
87
} else {
88
- $offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (($lastpostmodified - $post->post_modified_gmt) * $age_weight);
89
$priority = $post_priority + round($offset,1);
90
}
91
$priority = ($priority > $max_priority) ? $max_priority : $priority;
@@ -94,7 +96,7 @@ while ( have_posts() ) : the_post();
94
<url>
95
<loc><?php the_permalink_rss() ?></loc>
96
<lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $post->post_modified_gmt, false) ?></lastmod>
97
- <?php if($post->comment_count > ($totalcommentcount->approved / 2)) { ?>
98
<changefreq>daily</changefreq>
99
<?php } else if($post->comment_count > 0 ) { ?>
100
<changefreq>weekly</changefreq>
14
$level_weight = 0.1;
15
16
// site variables
17
+ $_post_count = wp_count_posts('post');
18
+ $_page_count = wp_count_posts('page');
19
+ $_totalcommentcount = wp_count_comments();
20
+
21
+ $lastpostmodified_GMT = get_lastpostmodified('GMT'); // last posts modified date
22
+ $lastpostmodified = mysql2date('U',$lastpostmodified_GMT); // last posts modified date in Unix seconds
23
+ $firstpostmodified = mysql2date('U',get_firstpostmodified('GMT')); // get_firstpostmodified() function defined in xml-sitemap.php !
24
+ $average_commentcount = $_totalcommentcount->approved/($_post_count->publish + $_page_count->publish);
25
26
// calculated presets
27
+ if ($_totalcommentcount->approved > 0)
28
+ $comment_weight = ($max_priority - $min_priority) / $_totalcommentcount->approved;
29
30
+ if ($_post_count->publish > $_page_count->publish) { // site emphasis on posts
31
$post_priority = 0.7;
32
$page_priority = 0.4;
33
} else { // site emphasis on pages
62
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
63
<url>
64
<loc><?php bloginfo_rss('url') ?>/</loc>
65
+ <lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $lastpostmodified_GMT, false); ?></lastmod>
66
<changefreq>daily</changefreq>
67
<priority>1.0</priority>
68
</url>
87
$offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (count($ancestors) * $level_weight);
88
$priority = $page_priority + round($offset,1);
89
} else {
90
+ $offset = (($post->comment_count - $average_commentcount) * $comment_weight) - (($lastpostmodified - mysql2date('U',$post->post_modified_gmt)) * $age_weight);
91
$priority = $post_priority + round($offset,1);
92
}
93
$priority = ($priority > $max_priority) ? $max_priority : $priority;
96
<url>
97
<loc><?php the_permalink_rss() ?></loc>
98
<lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', $post->post_modified_gmt, false) ?></lastmod>
99
+ <?php if($post->comment_count > ($_totalcommentcount->approved / 2)) { ?>
100
<changefreq>daily</changefreq>
101
<?php } else if($post->comment_count > 0 ) { ?>
102
<changefreq>weekly</changefreq>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravan
4
Tags: sitemap, xml sitemap, google, yahoo, bing, feed, wpmu
5
Requires at least: 2.6
6
Tested up to: 3.0
7
- Stable tag: 3.6
8
9
Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, Bing, Ask and others.
10
@@ -177,6 +177,9 @@ Yes.
177
178
== Changelog ==
179
180
= 3.6 =
181
* massive priority calculation improvement
182
4
Tags: sitemap, xml sitemap, google, yahoo, bing, feed, wpmu
5
Requires at least: 2.6
6
Tested up to: 3.0
7
+ Stable tag: 3.6.1
8
9
Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, Bing, Ask and others.
10
177
178
== Changelog ==
179
180
+ = 3.6.1 =
181
+ * BUGFIX: wrong date calculation on blogs less than 1 year old
182
+
183
= 3.6 =
184
* massive priority calculation improvement
185
xml-sitemap.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: XML Sitemap Feed
4
Plugin URI: http://4visions.nl/portfolio/wordpress-plugins/xml-sitemap-feed/
5
Description: Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, Bing, Ask and others.
6
- Version: 3.6
7
Author: RavanH
8
Author URI: http://4visions.nl/
9
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed&item_number=2%2e6%2e2%2e9&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
@@ -37,7 +37,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravan
37
-------------------- */
38
39
// set version
40
- define('XMLSF_VERSION','3.6');
41
42
// dir
43
$xmlsf_dir = dirname(__FILE__);
3
Plugin Name: XML Sitemap Feed
4
Plugin URI: http://4visions.nl/portfolio/wordpress-plugins/xml-sitemap-feed/
5
Description: Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, Bing, Ask and others.
6
+ Version: 3.6.1
7
Author: RavanH
8
Author URI: http://4visions.nl/
9
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed&item_number=2%2e6%2e2%2e9&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
37
-------------------- */
38
39
// set version
40
+ define('XMLSF_VERSION','3.6.1');
41
42
// dir
43
$xmlsf_dir = dirname(__FILE__);