Version Description
(March 16, 2015) = * New layout for both html and xml sitemaps * Created a logo for the plugin * Added a banner * Added screenshots * Fixed bug with custom post types
Download this release
Release Info
Developer | Webbjocke |
Plugin | Simple Wp Sitemap |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- css/html.css +29 -56
- css/xml.css +2 -7
- readme.txt +12 -1
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- simple-wp-sitemap.php +1 -2
- simpleWpMapBuilder.php +20 -26
css/html.css
CHANGED
@@ -2,82 +2,55 @@
|
|
2 |
margin: 0;
|
3 |
padding: 0;
|
4 |
}
|
5 |
-
html{
|
6 |
-
background: #edf4fa;
|
7 |
-
}
|
8 |
body{
|
9 |
-
max-width: 960px;
|
10 |
-
margin: 20px auto;
|
11 |
-
padding: 20px 4%;
|
12 |
-
box-shadow: 1px 1px 5px #d1d1d1;
|
13 |
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
14 |
-
background: white;
|
15 |
-
border-radius: 5px;
|
16 |
-
}
|
17 |
-
h1{
|
18 |
-
margin: 10px 0 20px 5px;
|
19 |
-
}
|
20 |
-
p{
|
21 |
-
float: left;
|
22 |
-
word-break: break-all;
|
23 |
-
}
|
24 |
-
p:nth-child(2n){
|
25 |
-
float: right;
|
26 |
}
|
27 |
a{
|
28 |
text-decoration: none;
|
29 |
color: black;
|
30 |
-
|
31 |
transition: all 0.3s;
|
32 |
}
|
33 |
a:hover{
|
34 |
-
background:
|
35 |
-
color: white;
|
36 |
}
|
37 |
-
|
38 |
-
|
39 |
-
padding: 5px 5px 5px 0;
|
40 |
-
border-left: 1px solid #0f669c;
|
41 |
-
border-right: 1px solid #0f669c;
|
42 |
-
border-bottom: 1px solid #0f669c;
|
43 |
}
|
44 |
-
|
45 |
-
|
46 |
}
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
53 |
}
|
54 |
-
|
55 |
-
|
56 |
}
|
57 |
#attr{
|
58 |
-
|
59 |
-
margin: 25px 0 0 0;
|
60 |
text-align: right;
|
61 |
font-size: 0.8em;
|
62 |
-
|
63 |
-
}
|
64 |
-
#attr a{
|
65 |
-
color: gray;
|
66 |
-
}
|
67 |
-
#attr a:hover{
|
68 |
-
color: #b2cde0;
|
69 |
-
background: none;
|
70 |
}
|
71 |
@media screen and (max-width: 960px){
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
p{
|
76 |
-
width: 100%;
|
77 |
-
margin-left: 5px;
|
78 |
}
|
79 |
-
|
80 |
-
float:
|
81 |
-
|
82 |
}
|
83 |
}
|
2 |
margin: 0;
|
3 |
padding: 0;
|
4 |
}
|
|
|
|
|
|
|
5 |
body{
|
|
|
|
|
|
|
|
|
6 |
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
8 |
a{
|
9 |
text-decoration: none;
|
10 |
color: black;
|
11 |
+
word-break: break-all;
|
12 |
transition: all 0.3s;
|
13 |
}
|
14 |
a:hover{
|
15 |
+
background: whitesmoke;
|
|
|
16 |
}
|
17 |
+
ul{
|
18 |
+
padding: 10px 0 10px 20px;
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
+
h1{
|
21 |
+
margin: 20px 0;
|
22 |
}
|
23 |
+
#wrapper{
|
24 |
+
max-width: 960px;
|
25 |
+
padding: 0 2% 40px 2%;
|
26 |
+
margin: 0 auto;
|
27 |
+
}
|
28 |
+
.date, .header-date{
|
29 |
+
float: right;
|
30 |
}
|
31 |
+
.header{
|
32 |
+
overflow: auto;
|
33 |
+
clear: left;
|
34 |
+
padding-bottom: 5px;
|
35 |
+
border-bottom: 5px solid lightgray;
|
36 |
+
font-size: 1.2em;
|
37 |
}
|
38 |
+
.header-txt{
|
39 |
+
float: left;
|
40 |
}
|
41 |
#attr{
|
42 |
+
width: 100%;
|
|
|
43 |
text-align: right;
|
44 |
font-size: 0.8em;
|
45 |
+
margin-top: 25px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
@media screen and (max-width: 960px){
|
48 |
+
.date{
|
49 |
+
float: none;
|
50 |
+
display: block;
|
|
|
|
|
|
|
51 |
}
|
52 |
+
.header-date{
|
53 |
+
float: none;
|
54 |
+
clear: left;
|
55 |
}
|
56 |
}
|
css/xml.css
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
urlset{
|
|
|
2 |
max-width: 960px;
|
3 |
margin: 10px auto;
|
4 |
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
@@ -8,24 +9,18 @@ url{
|
|
8 |
overflow: auto;
|
9 |
padding: 5px;
|
10 |
font-size: 0.9em;
|
11 |
-
border-top: 1px solid gray;
|
12 |
-
border-right: 1px solid gray;
|
13 |
-
border-left: 1px solid gray;
|
14 |
word-break: break-all;
|
15 |
}
|
16 |
url:nth-child(2n+1){
|
17 |
background: whitesmoke;
|
18 |
}
|
19 |
-
url:last-child{
|
20 |
-
border-bottom: 1px solid gray;
|
21 |
-
}
|
22 |
loc{
|
23 |
float: left;
|
24 |
}
|
25 |
lastmod{
|
26 |
float: right;
|
27 |
}
|
28 |
-
@media screen and (max-width:
|
29 |
loc, lastmod{
|
30 |
width: 100%;
|
31 |
float: left;
|
1 |
urlset{
|
2 |
+
display: block;
|
3 |
max-width: 960px;
|
4 |
margin: 10px auto;
|
5 |
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
9 |
overflow: auto;
|
10 |
padding: 5px;
|
11 |
font-size: 0.9em;
|
|
|
|
|
|
|
12 |
word-break: break-all;
|
13 |
}
|
14 |
url:nth-child(2n+1){
|
15 |
background: whitesmoke;
|
16 |
}
|
|
|
|
|
|
|
17 |
loc{
|
18 |
float: left;
|
19 |
}
|
20 |
lastmod{
|
21 |
float: right;
|
22 |
}
|
23 |
+
@media screen and (max-width: 960px){
|
24 |
loc, lastmod{
|
25 |
width: 100%;
|
26 |
float: left;
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
5 |
Tags: sitemap, google sitemap, xml, simple sitemap, html, xml sitemap, html sitemap, seo, seo sitemap
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.1.1
|
8 |
-
Stable tag: 1.0.
|
9 |
|
10 |
An easy, fast and secure plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you dont have to!
|
11 |
|
@@ -19,6 +19,8 @@ Also supports the option to add pages to the sitemaps that aren't part of your o
|
|
19 |
|
20 |
So why use this instead of the other hundreds(?) of sitemap plugins that's out are and which has thousands(?) of downloads? Well for one thing it's just an easy, fast and secure plugin that will just work for you, and it also makes the life pretty easy for search engines that wants to index your site!
|
21 |
|
|
|
|
|
22 |
== Installation ==
|
23 |
|
24 |
1. 1. Go to the plugins page in your wordpress admin area and hit "add new".
|
@@ -36,9 +38,18 @@ None so far :)
|
|
36 |
== Screenshots ==
|
37 |
|
38 |
1. Settings page
|
|
|
|
|
39 |
|
40 |
== Changelog ==
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
= 1.0.2 (March 14, 2015) =
|
43 |
* Messed up the upload, try again
|
44 |
|
5 |
Tags: sitemap, google sitemap, xml, simple sitemap, html, xml sitemap, html sitemap, seo, seo sitemap
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.1.1
|
8 |
+
Stable tag: 1.0.3
|
9 |
|
10 |
An easy, fast and secure plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you dont have to!
|
11 |
|
19 |
|
20 |
So why use this instead of the other hundreds(?) of sitemap plugins that's out are and which has thousands(?) of downloads? Well for one thing it's just an easy, fast and secure plugin that will just work for you, and it also makes the life pretty easy for search engines that wants to index your site!
|
21 |
|
22 |
+
And yes, of course the sitemaps are mobile friendly :)
|
23 |
+
|
24 |
== Installation ==
|
25 |
|
26 |
1. 1. Go to the plugins page in your wordpress admin area and hit "add new".
|
38 |
== Screenshots ==
|
39 |
|
40 |
1. Settings page
|
41 |
+
2. Html sitemap
|
42 |
+
3. Xml sitemap
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= 1.0.3 (March 16, 2015) =
|
47 |
+
* New layout for both html and xml sitemaps
|
48 |
+
* Created a logo for the plugin
|
49 |
+
* Added a banner
|
50 |
+
* Added screenshots
|
51 |
+
* Fixed bug with custom post types
|
52 |
+
|
53 |
= 1.0.2 (March 14, 2015) =
|
54 |
* Messed up the upload, try again
|
55 |
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
simple-wp-sitemap.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Simple Wp Sitemap
|
5 |
* Plugin URI: https://wordpress.org/plugins/simple-wp-sitemap/
|
6 |
* Description: An easy, fast and secure plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you dont have to!
|
7 |
-
* Version: 1.0.
|
8 |
* Author: Webbjocke
|
9 |
* Author URI: http://www.webbjocke.com/
|
10 |
* License: GPLv3
|
@@ -87,7 +87,6 @@ class SimpleWpSitemap {
|
|
87 |
</div>
|
88 |
<?php }
|
89 |
}
|
90 |
-
|
91 |
add_action('admin_menu', array('SimpleWpSitemap', 'sitemapAdminSetup'));
|
92 |
add_action('deleted_post', array('SimpleWpSitemap', 'updateSitemaps'));
|
93 |
add_action('save_post', array('SimpleWpSitemap', 'updateSitemaps'));
|
4 |
* Plugin Name: Simple Wp Sitemap
|
5 |
* Plugin URI: https://wordpress.org/plugins/simple-wp-sitemap/
|
6 |
* Description: An easy, fast and secure plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you dont have to!
|
7 |
+
* Version: 1.0.3
|
8 |
* Author: Webbjocke
|
9 |
* Author URI: http://www.webbjocke.com/
|
10 |
* License: GPLv3
|
87 |
</div>
|
88 |
<?php }
|
89 |
}
|
|
|
90 |
add_action('admin_menu', array('SimpleWpSitemap', 'sitemapAdminSetup'));
|
91 |
add_action('deleted_post', array('SimpleWpSitemap', 'updateSitemaps'));
|
92 |
add_action('save_post', array('SimpleWpSitemap', 'updateSitemaps'));
|
simpleWpMapBuilder.php
CHANGED
@@ -82,7 +82,7 @@ class SimpleWpMapBuilder {
|
|
82 |
|
83 |
// Returns an html string
|
84 |
private function getHtml($link, $date){
|
85 |
-
return "\t<
|
86 |
}
|
87 |
|
88 |
// Returns an xml string
|
@@ -92,7 +92,7 @@ class SimpleWpMapBuilder {
|
|
92 |
|
93 |
// Returns table headers with specific names (has been changed to div)
|
94 |
private function htmlTableH($name){
|
95 |
-
return "\t<div class=\"header\">\n\t\t<p>$name:</p>\n\t\t<p>Last modified:</p>\n\t</div>\n";
|
96 |
}
|
97 |
|
98 |
// Creates the actual sitemaps content, and querys the database
|
@@ -100,10 +100,9 @@ class SimpleWpMapBuilder {
|
|
100 |
$q = new WP_Query('post_type=any&posts_per_page=-1');
|
101 |
$name = get_bloginfo('name');
|
102 |
$xml = sprintf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text/css\" href=\"%s/css/xml.css\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n", $this->url);
|
103 |
-
$html = sprintf("<!doctype html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t<title>%s Html Sitemap</title>\n\t<link rel=\"stylesheet\" href=\"%s/css/html.css\">\n</head>\n<body>\n\t<h1>%s Html Sitemap</h1>\n%s", $name, $this->url, $name, $this->htmlTableH('Home'));
|
104 |
$posts = array('xml' => '', 'html' => '');
|
105 |
$pages = array('xml' => '', 'html' => '');
|
106 |
-
$others = array('xml' => '', 'html' => '');
|
107 |
$homePage = false;
|
108 |
|
109 |
if ($q->have_posts()) {
|
@@ -113,71 +112,66 @@ class SimpleWpMapBuilder {
|
|
113 |
$link = esc_url(get_permalink());
|
114 |
$date = esc_html(get_the_modified_date('Y-m-d\TH:i:sP'));
|
115 |
|
116 |
-
if (!$this->isBlockedUrl($link)){
|
117 |
-
if ($link === $this->homeUrl){
|
118 |
$xml .= $this->getXml($link, $date);
|
119 |
$html .= $this->getHtml($link, $date);
|
120 |
$homePage = true;
|
121 |
}
|
122 |
-
elseif ('
|
123 |
-
$posts['xml'] .= $this->getXml($link, $date);
|
124 |
-
$posts['html'] .= $this->getHtml($link, $date);
|
125 |
-
}
|
126 |
-
elseif ('page' === get_post_type()){
|
127 |
$pages['xml'] .= $this->getXml($link, $date);
|
128 |
$pages['html'] .= $this->getHtml($link, $date);
|
129 |
}
|
130 |
-
else{
|
131 |
-
$
|
132 |
-
$
|
133 |
}
|
134 |
}
|
135 |
}
|
136 |
}
|
137 |
|
138 |
-
$localArr = $this->mergeArraysAndGetOtherPages($posts, $pages, $
|
139 |
|
140 |
$this->xml = sprintf("%s%s</urlset>", $xml, $localArr['xml']);
|
141 |
-
$this->html = sprintf("%s%s
|
142 |
wp_reset_postdata();
|
143 |
}
|
144 |
|
145 |
// Displays attribution link. Not default, user has to check a checkbox for this to be displayed (returns an empty string as default)
|
146 |
private function attributionLink(){
|
147 |
if (get_option('simple_wp_attr_link')){
|
148 |
-
return "<p id=\"attr\">Generated by: <a href=\"http://www.webbjocke.com/\">Simple Wp Sitemap</a></p
|
149 |
}
|
150 |
return '';
|
151 |
}
|
152 |
|
153 |
// Merges the arrays with post data into strings and gets user submitted pages
|
154 |
-
private function mergeArraysAndGetOtherPages($posts, $pages, $
|
155 |
$xml = '';
|
156 |
$html = '';
|
157 |
|
158 |
if (!$homePage){ // if homepage isn't found in the query add it here (for instance if it's not a real "page" it wont be found)
|
159 |
$date = date('Y-m-d\TH:i:sP');
|
160 |
$xml .= $this->getXml($this->homeUrl, $date);
|
161 |
-
$html .= $this->getHtml($this->homeUrl, $date);
|
|
|
|
|
|
|
162 |
}
|
163 |
|
164 |
if ($posts['xml']) {
|
165 |
$xml .= $posts['xml'];
|
166 |
-
$html .= $this->htmlTableH('Posts')
|
167 |
}
|
168 |
if ($pages['xml']) {
|
169 |
$xml .= $pages['xml'];
|
170 |
-
$html .= $this->htmlTableH('Pages')
|
171 |
-
}
|
172 |
-
if ($others['xml']) {
|
173 |
-
$xml .= $others['xml'];
|
174 |
-
$html .= $this->htmlTableH('Other') . $others['html'];
|
175 |
}
|
176 |
|
177 |
$otherPages = $this->getOtherPages();
|
178 |
if ($otherPages['xml']){
|
179 |
$xml .= $otherPages['xml'];
|
180 |
-
$html .= (
|
181 |
}
|
182 |
|
183 |
return array('xml' => $xml, 'html' => $html);
|
82 |
|
83 |
// Returns an html string
|
84 |
private function getHtml($link, $date){
|
85 |
+
return "\t\t<li>\n\t\t\t<a title=\"$link\" href=\"$link\">$link</a>\n\t\t\t<span class=\"date\">$date</span>\n\t\t</li>\n";
|
86 |
}
|
87 |
|
88 |
// Returns an xml string
|
92 |
|
93 |
// Returns table headers with specific names (has been changed to div)
|
94 |
private function htmlTableH($name){
|
95 |
+
return "\t<div class=\"header\">\n\t\t<p class=\"header-txt\">$name:</p>\n\t\t<p class=\"header-date\">Last modified:</p>\n\t</div>\n";
|
96 |
}
|
97 |
|
98 |
// Creates the actual sitemaps content, and querys the database
|
100 |
$q = new WP_Query('post_type=any&posts_per_page=-1');
|
101 |
$name = get_bloginfo('name');
|
102 |
$xml = sprintf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text/css\" href=\"%s/css/xml.css\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n", $this->url);
|
103 |
+
$html = sprintf("<!doctype html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t<title>%s Html Sitemap</title>\n\t<link rel=\"stylesheet\" href=\"%s/css/html.css\">\n</head>\n<body>\n<div id=\"wrapper\">\n\n\t<h1>%s Html Sitemap</h1>\n\n%s\t<ul>\n", $name, $this->url, $name, $this->htmlTableH('Home'));
|
104 |
$posts = array('xml' => '', 'html' => '');
|
105 |
$pages = array('xml' => '', 'html' => '');
|
|
|
106 |
$homePage = false;
|
107 |
|
108 |
if ($q->have_posts()) {
|
112 |
$link = esc_url(get_permalink());
|
113 |
$date = esc_html(get_the_modified_date('Y-m-d\TH:i:sP'));
|
114 |
|
115 |
+
if (!$this->isBlockedUrl($link)) {
|
116 |
+
if ($link === $this->homeUrl) {
|
117 |
$xml .= $this->getXml($link, $date);
|
118 |
$html .= $this->getHtml($link, $date);
|
119 |
$homePage = true;
|
120 |
}
|
121 |
+
elseif ('page' === get_post_type()) {
|
|
|
|
|
|
|
|
|
122 |
$pages['xml'] .= $this->getXml($link, $date);
|
123 |
$pages['html'] .= $this->getHtml($link, $date);
|
124 |
}
|
125 |
+
else { // posts (also all custom post types are added here)
|
126 |
+
$posts['xml'] .= $this->getXml($link, $date);
|
127 |
+
$posts['html'] .= $this->getHtml($link, $date);
|
128 |
}
|
129 |
}
|
130 |
}
|
131 |
}
|
132 |
|
133 |
+
$localArr = $this->mergeArraysAndGetOtherPages($posts, $pages, $homePage);
|
134 |
|
135 |
$this->xml = sprintf("%s%s</urlset>", $xml, $localArr['xml']);
|
136 |
+
$this->html = sprintf("%s%s%s</div>\n</body>\n</html>", $html, $localArr['html'], $this->attributionLink());
|
137 |
wp_reset_postdata();
|
138 |
}
|
139 |
|
140 |
// Displays attribution link. Not default, user has to check a checkbox for this to be displayed (returns an empty string as default)
|
141 |
private function attributionLink(){
|
142 |
if (get_option('simple_wp_attr_link')){
|
143 |
+
return "\t<p id=\"attr\">Generated by: <a href=\"http://www.webbjocke.com/\">Simple Wp Sitemap</a></p>\n"; // will be changed to like webbjocke.com/simple-wp-sitemap or plugin page on wordpress.org if the plugin gets accepted
|
144 |
}
|
145 |
return '';
|
146 |
}
|
147 |
|
148 |
// Merges the arrays with post data into strings and gets user submitted pages
|
149 |
+
private function mergeArraysAndGetOtherPages($posts, $pages, $homePage){
|
150 |
$xml = '';
|
151 |
$html = '';
|
152 |
|
153 |
if (!$homePage){ // if homepage isn't found in the query add it here (for instance if it's not a real "page" it wont be found)
|
154 |
$date = date('Y-m-d\TH:i:sP');
|
155 |
$xml .= $this->getXml($this->homeUrl, $date);
|
156 |
+
$html .= sprintf("%s\t</ul>\n", $this->getHtml($this->homeUrl, $date));
|
157 |
+
}
|
158 |
+
else{ // just a formatting rule for html
|
159 |
+
$html .= "\t</ul>\n";
|
160 |
}
|
161 |
|
162 |
if ($posts['xml']) {
|
163 |
$xml .= $posts['xml'];
|
164 |
+
$html .= sprintf("%s\t<ul>\n%s\t</ul>\n", $this->htmlTableH('Posts'), $posts['html']);
|
165 |
}
|
166 |
if ($pages['xml']) {
|
167 |
$xml .= $pages['xml'];
|
168 |
+
$html .= sprintf("%s\t<ul>\n%s\t</ul>\n", $this->htmlTableH('Pages'), $pages['html']);
|
|
|
|
|
|
|
|
|
169 |
}
|
170 |
|
171 |
$otherPages = $this->getOtherPages();
|
172 |
if ($otherPages['xml']){
|
173 |
$xml .= $otherPages['xml'];
|
174 |
+
$html .= sprintf("%s\t<ul>\n%s\t</ul>\n", $this->htmlTableH('Other'), $otherPages['html']);
|
175 |
}
|
176 |
|
177 |
return array('xml' => $xml, 'html' => $html);
|