Changeset 3274255
- Timestamp:
- 04/16/2025 07:42:00 AM (9 months ago)
- Location:
- simple-xml-sitemap-generator/trunk
- Files:
-
- 2 edited
-
index.php (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-xml-sitemap-generator/trunk/index.php
r3206771 r3274255 1 <?php 1 <?php 2 2 /* 3 3 Plugin Name: Simple XML Sitemap Generator … … 8 8 Author URI: http://www.chefblogger.me 9 9 Requires at least: 3.5 10 Tested up to: 6. 7.110 Tested up to: 6.8 11 11 Text Domain: simple-xml-sitemap-generator 12 12 Domain Path: /languages … … 15 15 include 'conf.php'; 16 16 17 17 18 //mehrsprachigkeit 18 function my_plugin_initsimplexmlsitemapgenerator() { 19 load_plugin_textdomain( 'simple-xml-sitemap-generator', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 19 function my_plugin_initsimplexmlsitemapgenerator() 20 { 21 load_plugin_textdomain('simple-xml-sitemap-generator', false, dirname(plugin_basename(__FILE__)) . '/languages'); 20 22 } 21 23 add_action('init', 'my_plugin_initsimplexmlsitemapgenerator'); … … 25 27 add_filter('wp_sitemaps_enabled', '__return_false'); 26 28 29 27 30 /* Coding start */ 28 function sg_create_sitemap() { 31 function sg_create_sitemap() 32 { 29 33 $postsForSitemap = get_posts(array( 30 34 'numberposts' => -1, 31 35 'orderby' => 'modified', 32 'post_type' => array('post', 'page','product'),36 'post_type' => array('post', 'page', 'product'), 33 37 'order' => 'DESC' 34 38 )); … … 40 44 41 45 $xmlpost_id = get_the_ID(); 42 $xmlpost_id_check = nl2br(get_post_meta($xmlpost_id, 'sitemap',true));46 $xmlpost_id_check = nl2br(get_post_meta($xmlpost_id, 'sitemap', true)); 43 47 44 foreach ($postsForSitemap as $post) {48 foreach ($postsForSitemap as $post) { 45 49 setup_postdata($post); 46 50 … … 48 52 49 53 $xml_textid = $post->ID; 50 $xml_custom_field = nl2br(get_post_meta($xml_textid, 'sitemap',true));54 $xml_custom_field = nl2br(get_post_meta($xml_textid, 'sitemap', true)); 51 55 52 56 // score wert 53 $xml_sitemapscore = nl2br(get_post_meta($xml_textid, 'sitemapscore',true));57 $xml_sitemapscore = nl2br(get_post_meta($xml_textid, 'sitemapscore', true)); 54 58 55 if (is_numeric($xml_sitemapscore)) 56 { 59 if (is_numeric($xml_sitemapscore)) { 57 60 $xml_kontrolle_ob_zahl = '1'; 58 } 59 else 60 { 61 } else { 61 62 $xml_kontrolle_ob_zahl = '0'; 62 63 } … … 64 65 65 66 66 if ($xml_custom_field == 'no') 67 {67 if ($xml_custom_field == 'no') { 68 } else { 68 69 70 if ($xml_kontrolle_ob_zahl == '1') { 71 $sitemap .= '<url>' . 72 '<loc>' . get_permalink($post->ID) . '</loc>' . 73 '<lastmod>' . $postdate[0] . '</lastmod>' . 74 '<changefreq>daily</changefreq>' . 75 '<priority>' . $xml_sitemapscore . '</priority>' . 76 /* '<postid>'. $xml_textid . '</postid>'. */ 77 /* '<smap>'. $xml_custom_field . '</smap>'. */ 78 '</url>'; 79 } else { 80 81 $sitemap .= '<url>' . 82 '<loc>' . get_permalink($post->ID) . '</loc>' . 83 '<lastmod>' . $postdate[0] . '</lastmod>' . 84 '<changefreq>daily</changefreq>' . 85 '<priority>0.8</priority>' . 86 /* '<postid>'. $xml_textid . '</postid>'. */ 87 /* '<smap>'. $xml_custom_field . '</smap>'. */ 88 '</url>'; 89 } 69 90 } 70 else 71 { 72 73 if ($xml_kontrolle_ob_zahl == '1') 74 { 75 $sitemap .= '<url>'. 76 '<loc>'. get_permalink($post->ID) .'</loc>'. 77 '<lastmod>'. $postdate[0] . '</lastmod>'. 78 '<changefreq>daily</changefreq>'. 79 '<priority>'. $xml_sitemapscore . '</priority>'. 80 /* '<postid>'. $xml_textid . '</postid>'. */ 81 /* '<smap>'. $xml_custom_field . '</smap>'. */ 82 '</url>'; 83 } 84 else 85 { 86 87 $sitemap .= '<url>'. 88 '<loc>'. get_permalink($post->ID) .'</loc>'. 89 '<lastmod>'. $postdate[0] . '</lastmod>'. 90 '<changefreq>daily</changefreq>'. 91 '<priority>0.8</priority>'. 92 /* '<postid>'. $xml_textid . '</postid>'. */ 93 /* '<smap>'. $xml_custom_field . '</smap>'. */ 94 '</url>'; 95 } 91 } 96 92 97 93 94 /* ADD WP Kategorie */ 95 $sxmlsg_kategorien_view = get_option('sxmlsg_kategorien'); 96 97 if ($sxmlsg_kategorien_view == 'Ja') { 98 99 $now = time(); 100 $sxmlsg_kategorien_datum = date("Y-m-d", $now); 101 102 $categories = get_categories(array( 103 'orderby' => 'name', 104 'order' => 'ASC' 105 )); 106 107 108 foreach ($categories as $category) { 109 110 111 $sitemap .= '<url>' . 112 '<loc>' . get_category_link($category->term_id) . '</loc>' . 113 '<lastmod>' . $sxmlsg_kategorien_datum . '</lastmod>' . 114 '<changefreq>daily</changefreq>' . 115 '<priority>0.8</priority>' . 116 '</url>'; 98 117 } 99 118 100 119 101 120 102 } 103 104 105 /* ADD WP Kategorie */ 106 $sxmlsg_kategorien_view = get_option('sxmlsg_kategorien'); 107 108 if ($sxmlsg_kategorien_view == 'Ja') { 109 110 $now = time(); 111 $sxmlsg_kategorien_datum = date("Y-m-d",$now); 112 113 $categories = get_categories( array( 114 'orderby' => 'name', 115 'order' => 'ASC' 116 ) ); 117 118 119 foreach( $categories as $category ) { 120 121 122 $sitemap .= '<url>'. 123 '<loc>'. get_category_link( $category->term_id ) .'</loc>'. 124 '<lastmod>'. $sxmlsg_kategorien_datum .'</lastmod>'. 125 '<changefreq>daily</changefreq>'. 126 '<priority>0.8</priority>'. 127 '</url>'; 128 129 } 130 131 132 133 134 135 /* 121 122 123 /* 136 124 <url> 137 125 <loc>$sxmlsg_kategorien_link</loc> … … 141 129 </url> 142 130 */ 131 } 143 132 144 133 145 146 } 147 148 149 134 150 135 151 136 $sitemap .= '</urlset>'; … … 158 143 add_action("publish_page", "sg_create_sitemap"); 159 144 /* Ok that's all */ 160 ?> -
simple-xml-sitemap-generator/trunk/readme.txt
r3206771 r3274255 5 5 Version: 2.3 6 6 Requires at least: 3.0.1 7 Tested up to: 6. 7.17 Tested up to: 6.8 8 8 Stable tag: 2.3 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 11 12 add a sitemap to your wordpress website 12 add a sitemap to your wordpress website. 13 13 14 14 == Description == … … 64 64 = 2.2 = 65 65 * now you can add your own sitemap priority value to posts, pages or products. 66 67 66 = 2.1 = 68 67 * now you can exclude certain posts or pages or woocommerce produts from the xml sitemap. 69 70 68 = 2.0 = 71 69 * multilingual ( engl & german) - if you whant a other language - please contact me
Note: See TracChangeset
for help on using the changeset viewer.