Title: Scorpious's Replies | WordPress.org

---

# Scorpious

  [  ](https://wordpress.org/support/users/kuljit/)

 *   [Profile](https://wordpress.org/support/users/kuljit/)
 *   [Topics Started](https://wordpress.org/support/users/kuljit/topics/)
 *   [Replies Created](https://wordpress.org/support/users/kuljit/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/kuljit/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/kuljit/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/kuljit/engagements/)
 *   [Favorites](https://wordpress.org/support/users/kuljit/favorites/)

 Search replies:

## Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Feed Them Social - Social Media Feeds, Video, and Photo Galleries] How to show facebook "my posts" and "my shared posts" in one feed?](https://wordpress.org/support/topic/how-to-show-facebook-my-posts-and-my-shared-posts-in-one-feed/)
 *  Thread Starter [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/how-to-show-facebook-my-posts-and-my-shared-posts-in-one-feed/#post-6048420)
 * It is a personal facebook page that has my posts, and posts that I share from
   facebook pages of my friends. Using the shortcode (either type=group or type=
   page), I see my posts but not the ones I am “sharing” from my facebook page of
   my friends.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Old age issue with Sitemap :-(](https://wordpress.org/support/topic/old-age-issue-with-sitemap/)
 *  Thread Starter [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/old-age-issue-with-sitemap/#post-4463982)
 * Also there is a slight change in the code. Apparently Nextgen code is not PHP’s
   unserialize function. They have their custon unserialized funtion.
 * Modify :
 *     ```
       $arrSortOrder = unserialize($albumRow->sortorder);
       ```
   
 * TO:
 *     ```
       $arrSortOrder = Ngg_Serializable::unserialize($albumRow->sortorder);
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Old age issue with Sitemap :-(](https://wordpress.org/support/topic/old-age-issue-with-sitemap/)
 *  Thread Starter [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/old-age-issue-with-sitemap/#post-4463981)
 * Thanks for the input tizz. I understand that search engines should have indexed
   images anyway (i have all the meta data filled). But evidently they didn’t. Simple
   test was by checking number of indexed images in google webmaster OR even simpler
   google search results for images was showing 7 of 100+ images from my site.
    
   Evidently submitting sitemaps makes a difference. They all show up now with the
   updated code. A lot depends on robots file n stuff. Apparently this modified 
   worked a charms for me.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Andrea Pernici News Sitemap for Google] Sitemap problem](https://wordpress.org/support/topic/sitemap-problem-10/)
 *  [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/sitemap-problem-10/#post-4393308)
 * The plugin pulls in news/post updated in last 2 days.
    If you wish to pull from
   the beginning of time, goto this plugin editor page. There is only 1 php file.
   Open it and search for –
 * $twoDays = 2*24*60*60
 * change it to (for last 2000 days)
 * $twoDays = 2000*24*60*60
 * Save it. Build the sitemap. And change it back to original value.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Old age issue with Sitemap :-(](https://wordpress.org/support/topic/old-age-issue-with-sitemap/)
 *  Thread Starter [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/old-age-issue-with-sitemap/#post-4463975)
 * Here is the updated code for “\plugins\nextgen-gallery\products\photocrati_nextgen\
   modules\ngglegacy\lib\sitemap.php”
 * Please note that this is for nextgen 2.0 shortcodes. Also at this point the code
   only respects “album_ids” “gallery_ids”, and “image_ids”. I have not coded for“
   exclusions” and “category” attributes etc.
 *     ```
       <?php
       /**
       * Main PHP Class for XML Image Sitemaps
       *
       * @author 		Alex Rabe
       * @version      1.0
       * @copyright 	Copyright 2011
       *
       */
       class nggSitemaps {
   
           var $images	= array();
   
           /**
            * nggSitemaps::__construct()
            *
            * @return
            */
           function __construct() {
   
               add_filter('wpseo_sitemap_urlimages', array( &$this, 'add_wpseo_xml_sitemap_images'), 10, 2);
   
           }
   
           /**
            * Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ )
            *
            * @since Version 1.8.0
            * @param array $images
            * @param int $post ID
            * @return array $image list of all founded images
            */
           function add_wpseo_xml_sitemap_images( $images, $post_id )  {
   
               $this->images = $images;
   
               // first get the content of the post/page
               $p = get_post($post_id);
   
               // Backward check for older images
               $p->post_content = NextGEN_Shortcodes::convert_shortcode($p->post_content);
   
               // Don't process the images in the normal way
         		remove_all_shortcodes();
   
               // We cannot parse at this point a album, just galleries & single images
       		C_NextGen_Shortcode_Manager::add( 'singlepic', array(&$this, 'add_images' ) );
       		C_NextGen_Shortcode_Manager::add( 'thumb', array(&$this, 'add_images' ) );
       		C_NextGen_Shortcode_Manager::add( 'nggallery', array(&$this, 'add_gallery') );
       		C_NextGen_Shortcode_Manager::add( 'imagebrowser', array(&$this, 'add_gallery' ) );
       		C_NextGen_Shortcode_Manager::add( 'slideshow', array(&$this, 'add_gallery' ) );
   
               // KS-start: Code to accept new shortcode
               C_NextGen_Shortcode_Manager::add( 'ngg_images', array(&$this, 'add_ngg_images_tag' ) );
               // KS-end: Code to accept new shortcode
   
               // Search now for shortcodes
               do_shortcode( $p->post_content );
   
               return $this->images;
           }
   
           /**
            * Parse the gallery/imagebrowser/slideshow shortcode and return all images into an array
            *
            * @param string $atts
            * @return
            */
           function add_gallery( $atts ) {
   
               global $wpdb;
   
               extract(shortcode_atts(array(
                   'id'        => 0
               ), $atts ));
   
               // backward compat for user which uses the name instead, still deprecated
               if( !is_numeric($id) )
                   $id = $wpdb->get_var( $wpdb->prepare ("SELECT gid FROM $wpdb->nggallery WHERE name = '%s' ", $id) );
   
               $images = nggdb::get_gallery($id, 'pid', 'ASC', true, 1000);
   
               foreach ($images as $image) {
                   $newimage = array();
                   $newimage['src']   = $newimage['sc'] = $image->imageURL;
                   if ( !empty($image->title) )
                       $newimage['title'] = $image->title;
                   if ( !empty($image->alttext) )
                       $newimage['alt']   = $image->alttext;
                   $this->images[] = $newimage;
               }
   
               return '';
           }
   
           /**
            * Parse the single image shortcode and return all images into an array
            *
            * @param array $atts
            * @return
            */
           function add_images( $atts ) {
   
               extract(shortcode_atts(array(
                   'id'        => 0
               ), $atts ));
   
               // make an array out of the ids (for thumbs shortcode))
               $pids = explode( ',', $id );
   
               // Some error checks
               if ( count($pids) == 0 )
                   return;
   
               $images = nggdb::find_images_in_list( $pids );
   
               foreach ($images as $image) {
                   $newimage = array();
                   $newimage['src']   = $newimage['sc'] = $image->imageURL;
                   if ( !empty($image->title) )
                       $newimage['title'] = $image->title;
                   if ( !empty($image->alttext) )
                       $newimage['alt']   = $image->alttext;
                   $this->images[] = $newimage;
               }
   
               return '';
           }
   
       // KS-start: Code to accept new shortcode
   
           function add_ngg_images_tag( $atts ) {
   
               global $wpdb;
   
       	extract(shortcode_atts(array('image_ids' => 0,  'album_ids' => 1, 'gallery_ids' => 2), $atts ));
   
       	if ($image_ids!='' and $image_ids!=0){
       		// make an array out of the ids (for thumbs shortcode))
       		$pids = explode( ',', $image_ids );
       		// Some error checks
       		if ( count($pids) == 0 )
       			return;
       		$images = nggdb::find_images_in_list( $pids );
       		nggSitemaps::add_to_global_images_array($images);
       		return '';
       	}
   
       	if ($album_ids!='' and $album_ids!=0)
       		$gallery_ids = nggSitemaps::get_galleryIDs_from_albumID($album_ids);
   
       	if ($gallery_ids=='' or $gallery_ids==0)
       		return '';
   
       	$gallery_id_arr = explode(',',$gallery_ids);
   
       	foreach ($gallery_id_arr as $id) {
       		$images = nggdb::get_gallery($id, 'pid', 'ASC', true, 1000);
       		nggSitemaps::add_to_global_images_array($images);
       	}
   
               return '';
           }
   
          function get_galleryIDs_from_albumID($album_ids){
   
       	global $wpdb;
       	$albumRows = $wpdb->get_results ("SELECT sortorder FROM {$wpdb->prefix}ngg_album WHERE id IN (".$album_ids.")");
               $gallery_delim_ids = '';
       	if (empty ($albumRows)) {
       		return '';
       	}
       	else{
       		foreach ($albumRows as $albumRow) {
       			$arrSortOrder = unserialize($albumRow->sortorder);
   
       			for($i=0; $i < count($arrSortOrder); $i++){
       				if($i != (count($arrSortOrder)-1)){
       					$gallery_delim_ids .= (int)$arrSortOrder[$i].", ";
       				}elseif($i == (count($arrSortOrder)-1)){
       					$gallery_delim_ids .= (int)$arrSortOrder[$i]."";
       				}
       			}
       		}
   
       	}
       	return $gallery_delim_ids;
          }
   
          function add_to_global_images_array($images){
       	foreach ($images as $image) {
                   $newimage = array();
                   $newimage['src']   = $newimage['sc'] = $image->imageURL;
                   if ( !empty($image->title) )
                       $newimage['title'] = $image->title;
                   if ( !empty($image->alttext) )
                       $newimage['alt']   = $image->alttext;
                   $this->images[] = $newimage;
       	}
          }
   
       // KS-end: Code to accept new shortcode
   
       }
       $nggSitemaps = new nggSitemaps();
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[NextGEN Gallery Optimizer] How to create image sitemap for nextgen gallery please anyone tell me](https://wordpress.org/support/topic/how-to-create-image-sitemap-for-nextgen-gallery-please-anyone-tell-me/)
 *  [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/how-to-create-image-sitemap-for-nextgen-gallery-please-anyone-tell-me/page/2/#post-3473769)
 * I think I got WP-SEO working. It was a problem with NextGen Sitemap.php
 * Here is the updated code for “\plugins\nextgen-gallery\products\photocrati_nextgen\
   modules\ngglegacy\lib\sitemap.php”
 * Please note that this is for nextgen 2.0 shortcodes. Also at this point the code
   only respects “album_ids” “gallery_ids”, and “image_ids”. I have not coded for“
   exclusions” and “category” attributes etc.
 *     ```
       <?php
       /**
       * Main PHP Class for XML Image Sitemaps
       *
       * @author 		Alex Rabe
       * @version      1.0
       * @copyright 	Copyright 2011
       *
       */
       class nggSitemaps {
   
           var $images	= array();
   
           /**
            * nggSitemaps::__construct()
            *
            * @return
            */
           function __construct() {
   
               add_filter('wpseo_sitemap_urlimages', array( &$this, 'add_wpseo_xml_sitemap_images'), 10, 2);
   
           }
   
           /**
            * Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ )
            *
            * @since Version 1.8.0
            * @param array $images
            * @param int $post ID
            * @return array $image list of all founded images
            */
           function add_wpseo_xml_sitemap_images( $images, $post_id )  {
   
               $this->images = $images;
   
               // first get the content of the post/page
               $p = get_post($post_id);
   
               // Backward check for older images
               $p->post_content = NextGEN_Shortcodes::convert_shortcode($p->post_content);
   
               // Don't process the images in the normal way
         		remove_all_shortcodes();
   
               // We cannot parse at this point a album, just galleries & single images
       		C_NextGen_Shortcode_Manager::add( 'singlepic', array(&$this, 'add_images' ) );
       		C_NextGen_Shortcode_Manager::add( 'thumb', array(&$this, 'add_images' ) );
       		C_NextGen_Shortcode_Manager::add( 'nggallery', array(&$this, 'add_gallery') );
       		C_NextGen_Shortcode_Manager::add( 'imagebrowser', array(&$this, 'add_gallery' ) );
       		C_NextGen_Shortcode_Manager::add( 'slideshow', array(&$this, 'add_gallery' ) );
   
               // KS-start: Code to accept new shortcode
               C_NextGen_Shortcode_Manager::add( 'ngg_images', array(&$this, 'add_ngg_images_tag' ) );
               // KS-end: Code to accept new shortcode
   
               // Search now for shortcodes
               do_shortcode( $p->post_content );
   
               return $this->images;
           }
   
           /**
            * Parse the gallery/imagebrowser/slideshow shortcode and return all images into an array
            *
            * @param string $atts
            * @return
            */
           function add_gallery( $atts ) {
   
               global $wpdb;
   
               extract(shortcode_atts(array(
                   'id'        => 0
               ), $atts ));
   
               // backward compat for user which uses the name instead, still deprecated
               if( !is_numeric($id) )
                   $id = $wpdb->get_var( $wpdb->prepare ("SELECT gid FROM $wpdb->nggallery WHERE name = '%s' ", $id) );
   
               $images = nggdb::get_gallery($id, 'pid', 'ASC', true, 1000);
   
               foreach ($images as $image) {
                   $newimage = array();
                   $newimage['src']   = $newimage['sc'] = $image->imageURL;
                   if ( !empty($image->title) )
                       $newimage['title'] = $image->title;
                   if ( !empty($image->alttext) )
                       $newimage['alt']   = $image->alttext;
                   $this->images[] = $newimage;
               }
   
               return '';
           }
   
           /**
            * Parse the single image shortcode and return all images into an array
            *
            * @param array $atts
            * @return
            */
           function add_images( $atts ) {
   
               extract(shortcode_atts(array(
                   'id'        => 0
               ), $atts ));
   
               // make an array out of the ids (for thumbs shortcode))
               $pids = explode( ',', $id );
   
               // Some error checks
               if ( count($pids) == 0 )
                   return;
   
               $images = nggdb::find_images_in_list( $pids );
   
               foreach ($images as $image) {
                   $newimage = array();
                   $newimage['src']   = $newimage['sc'] = $image->imageURL;
                   if ( !empty($image->title) )
                       $newimage['title'] = $image->title;
                   if ( !empty($image->alttext) )
                       $newimage['alt']   = $image->alttext;
                   $this->images[] = $newimage;
               }
   
               return '';
           }
   
       // KS-start: Code to accept new shortcode
   
           function add_ngg_images_tag( $atts ) {
   
               global $wpdb;
   
       	extract(shortcode_atts(array('image_ids' => 0,  'album_ids' => 1, 'gallery_ids' => 2), $atts ));
   
       	if ($image_ids!='' and $image_ids!=0){
       		// make an array out of the ids (for thumbs shortcode))
       		$pids = explode( ',', $image_ids );
       		// Some error checks
       		if ( count($pids) == 0 )
       			return;
       		$images = nggdb::find_images_in_list( $pids );
       		nggSitemaps::add_to_global_images_array($images);
       		return '';
       	}
   
       	if ($album_ids!='' and $album_ids!=0)
       		$gallery_ids = nggSitemaps::get_galleryIDs_from_albumID($album_ids);
   
       	if ($gallery_ids=='' or $gallery_ids==0)
       		return '';
   
       	$gallery_id_arr = explode(',',$gallery_ids);
   
       	foreach ($gallery_id_arr as $id) {
       		$images = nggdb::get_gallery($id, 'pid', 'ASC', true, 1000);
       		nggSitemaps::add_to_global_images_array($images);
       	}
   
               return '';
           }
   
          function get_galleryIDs_from_albumID($album_ids){
   
       	global $wpdb;
       	$albumRows = $wpdb->get_results ("SELECT sortorder FROM {$wpdb->prefix}ngg_album WHERE id IN (".$album_ids.")");
               $gallery_delim_ids = '';
       	if (empty ($albumRows)) {
       		return '';
       	}
       	else{
       		foreach ($albumRows as $albumRow) {
       			$arrSortOrder = unserialize($albumRow->sortorder);
   
       			for($i=0; $i < count($arrSortOrder); $i++){
       				if($i != (count($arrSortOrder)-1)){
       					$gallery_delim_ids .= (int)$arrSortOrder[$i].", ";
       				}elseif($i == (count($arrSortOrder)-1)){
       					$gallery_delim_ids .= (int)$arrSortOrder[$i]."";
       				}
       			}
       		}
   
       	}
       	return $gallery_delim_ids;
          }
   
          function add_to_global_images_array($images){
       	foreach ($images as $image) {
                   $newimage = array();
                   $newimage['src']   = $newimage['sc'] = $image->imageURL;
                   if ( !empty($image->title) )
                       $newimage['title'] = $image->title;
                   if ( !empty($image->alttext) )
                       $newimage['alt']   = $image->alttext;
                   $this->images[] = $newimage;
       	}
          }
   
       // KS-end: Code to accept new shortcode
   
       }
       $nggSitemaps = new nggSitemaps();
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[NextGEN Gallery Optimizer] How to create image sitemap for nextgen gallery please anyone tell me](https://wordpress.org/support/topic/how-to-create-image-sitemap-for-nextgen-gallery-please-anyone-tell-me/)
 *  [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/how-to-create-image-sitemap-for-nextgen-gallery-please-anyone-tell-me/page/2/#post-3473768)
 * Plus I am working to make the same work for WP-SEO. I found “\plugins\nextgen-
   gallery\products\photocrati_nextgen\modules\ngglegacy\lib\**sitemap.php**” where
   I added code to take new shortcodes.
    But it is not working. I am not sure how
   WP-SEO makes a call to this file. If someone can shed some light on that then
   I can come up with a solution. A unit test with dummy post-content (in a variable)
   is working with the code I have. Just need to know who it gets triggered from
   WP-SEO. Would appreciate some help.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[NextGEN Gallery Optimizer] How to create image sitemap for nextgen gallery please anyone tell me](https://wordpress.org/support/topic/how-to-create-image-sitemap-for-nextgen-gallery-please-anyone-tell-me/)
 *  [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/how-to-create-image-sitemap-for-nextgen-gallery-please-anyone-tell-me/page/2/#post-3473767)
 * I am using Google sitemap for images. I have modified image-sitemap.php file 
   to include nextgen 2.0 shortcodes. Please note at this point the code only respects“
   album_ids” “gallery_ids”, and “image_ids”. I have not coded for “exclusions” 
   and “category” attributes etc. Please not I am coding in PHP after a decade (
   so there is room for improvement).
 *     ```
       <?php
       /*
       Plugin Name: Google XML Sitemap for Images
       Plugin URI: http://www.labnol.org/internet/google-image-sitemap-for-wordpress/14125/
       Description: This plugin will generate a XML Image Sitemap for your WordPress blog. Open the <a href="tools.php?page=image-sitemap-generate-page">settings page</a> to create your image sitemap.
       Author: Amit Agarwal
       Version: 2.1.3
       Author URI: http://www.labnol.org/
       */
   
       add_action('admin_menu', 'image_sitemap_generate_page');
   
       function image_sitemap_generate_page() {
           if(function_exists('add_submenu_page')) add_submenu_page('tools.php', __('Image Sitemap'),
       	    __('Image Sitemap'), 'manage_options', 'image-sitemap-generate-page', 'image_sitemap_generate');
       }
   
       /* @author  VJTD3 <http://www.VJTD3.com> */
       function IsImageSitemapWritable($filename) {
           if(!is_writable($filename)) {
               if(!@chmod($filename, 0666)) {
                   $pathtofilename = dirname($filename);
                   if(!is_writable($pathtofilename)) {
                       if(!@chmod($pathtoffilename, 0666)) {
                           return false;
                       }
                   }
               }
           }
           return true;
       }
   
       function EscapeXMLEntities($xml) {
           return str_replace(array('&', '<', '>', '\'', '"'), array('&', '<', '>', '&apos;', '&quot;'), $xml);
       }
   
       function image_sitemap_generate () {
         if ($_POST ['submit']) {
           $st = image_sitemap_loop ();
            if (!$st) {
       echo '<br /><div class="error"><h2>Oops!</h2><p>The XML sitemap was generated successfully but the  plugin was unable to save the xml to your WordPress root folder at <strong>' . $_SERVER["DOCUMENT_ROOT"] . '</strong>.</p><p>Please ensure that the folder has appropriate <a href="http://codex.wordpress.org/Changing_File_Permissions" target="_blank">write permissions</a>.</p><p> You can either use the chmod command in Unix or use your FTP Manager to change the permission of the folder to 0666 and then try generating the sitemap again.</p><p>If the issue remains unresolved, please post the error message in this <a target="_blank" href="http://wordpress.org/tags/google-image-sitemap?forum_id=10#postform">WordPress forum</a>.</p></div>';
       exit();
       }
       ?>
   
       <div class="wrap">
       <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
       if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
       <div style="width:800px; padding:10px 20px; background-color:#eee; font-size:.95em; font-family:Georgia;margin:20px">
         <h2>XML Sitemap for Images</h2>
         <?php $sitemapurl = get_bloginfo('url') . "/sitemap-image.xml"; ?>
         <p>The <a target="_blank" href="<?php echo $sitemapurl; ?>">XML Sitemap</a> was generated successfully and you can <a target="_blank" href="http://www.google.com/webmasters/sitemaps/ping?sitemap=<?php echo $sitemapurl; ?>">ping Google</a> to inform them about your updated sitemap.</p>
         <p>This WordPress Plugin is written by <a href="http://www.labnol.org/about/">Amit Agarwal</a> of <a href="http://www.labnol.org/">Digital Inspiration</a>. For feedback or suggestions on improving this plugin, please send me an email at amit@labnol.org</p>
         <p><a href="https://twitter.com/labnol" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow @labnol</a>
           <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fdigital.inspiration&send=false&layout=button_count&width=300&show_faces=false&action=recommend&colorscheme=light&font=arial&height=24&appId=197498283654348" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:20px;" allowTransparency="true"></iframe>
         </p>
       </div>
       <?php } else { ?>
       <div class="wrap">
       <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
       <div style="width:800px; padding:10px 20px; background-color:#eee; font-size:.95em; font-family:Georgia;margin:20px">
         <h2>XML Sitemap for Images</h2>
         <p>Sitemaps are a way to tell Google and other search engines about web pages, images and video content on your site that they may otherwise not discover. </p>
         <form id="options_form" method="post" action="">
           <div class="submit">
             <input type="submit" name="submit" id="sb_submit" value="Generate Image Sitemap" />
           </div>
         </form>
         <p>Click the button above to generate a Image Sitemap for your website. Once you have created your Sitemap, you should submit it to Google using Webmaster Tools. </p>
         <p>You may also want to create separate <a href="http://wordpress.org/extend/plugins/xml-sitemaps-for-videos/">Video Sitemap</a> and <a href="http://wordpress.org/extend/plugins/google-mobile-sitemap/">Mobile Sitemap</a> for improving your site's visibility in Google.</p>
         <p>This WordPress Plugin is written by <a href="http://www.labnol.org/about/">Amit Agarwal</a> of <a href="http://www.labnol.org/">Digital Inspiration</a>. </p>
       </div>
       <?php }
       }
   
       function ks_get_ngg_album_ID_Matches($content) {
       	return  ks_getIDs_for_ngg_tag($content, 'album_ids');
       }
   
       function ks_get_ngg_gallery_ID_Matches($content) {
       	return  ks_getIDs_for_ngg_tag($content, 'gallery_ids');
       }
   
       function ks_getIDs_for_ngg_tag($content, $tag){
       	$search_expr = '/[tagname]=("|\')?[0-9]+(,[0-9]+)*("|\')?/';
       	$search_expr = str_replace("[tagname]", $tag, $search_expr);
       	$search_delimited_number_exp = '/[0-9]+(,[0-9]+)*/';
       	if(preg_match_all($search_expr, $content, $matches, PREG_SET_ORDER)) {
       		$allTagIDs='';
       		foreach($matches as $match) {
       			preg_match($search_delimited_number_exp, $match[0], $del_numbers, PREG_OFFSET_CAPTURE);
       			if ($del_numbers[0][0]!=''){
       				$allTagIDs .= $del_numbers[0][0] . ',';
       			}
       		}
       	}
       	return rtrim($allTagIDs, ',');
       }
   
       function ks_get_image_Tags_for_gallery_IDs($ids, $imgTemplateNode){
       	global $wpdb;
       	// get gallery titles according to id's we got
       	//$query_titles = "SELECT title, gid FROM wp_ngg_gallery WHERE gid IN('".$ids."')";
       	$FinalGalleryImageTags='';
       	$galleries = $wpdb->get_results ("SELECT gid, name, title, galdesc, path FROM {$wpdb->prefix}ngg_gallery
       		WHERE gid IN (".$ids.")"); // get gallery path
   
       	if (empty ($galleries)) {
       		return ''; //no pics? do nothing
       	} else { //pics found!
       		$domain = get_bloginfo('url');
       		foreach ($galleries as $gallery) {
       			$imgNodeGallery = str_replace('[img_caption]', $gallery->name.' : '. $gallery->galdesc.' [img_caption]', $imgTemplateNode);
       			$imgBaseUrl = $domain.'/'. $gallery->path .'/';
       			$pics = $wpdb->get_results ("SELECT filename, description, alttext FROM {$wpdb->prefix}ngg_pictures
       				WHERE galleryid = ".$gallery->gid); //get fileinformation , should be made with one query using JOINS ???
   
       			if (empty ($pics)) {
       				    return '';
       			} else { //pics found!
       				foreach ($pics as $pic) {
       					//return 'loompa-'.$imgNodeGallery.'</br>';
       					$currImageTag =  str_replace('[img_caption]', $pic->alttext, $imgNodeGallery);
       					$currImageTag =  str_replace('[img_title]', $pic->description, $currImageTag);
       					$currImageTag =  str_replace('[img_url]', ($imgBaseUrl . $pic->filename), $currImageTag);
   
       					$FinalGalleryImageTags .=  $currImageTag;
       				}
       			}
       		}
       	}
       	return $FinalGalleryImageTags;
       }
   
       function ks_add_ngg_tags($post_content){
       	global $wpdb;
       		// ngg code - start
       		$imgNode = "<image:image><image:loc>[img_url]</image:loc><image:title>[img_title]</image:title><image:caption>[img_caption]</image:caption><image:geo_location>[img_geo_location]</image:geo_location></image:image>";
       		$imgNode = str_replace('[img_geo_location]', 'New York City, New York, USA', $imgNode);
   
       		$allImageTags='';
       	       if (strpos($post_content, '[ngg_images') !== FALSE) {
       			$album_ids = ks_get_ngg_album_ID_Matches($post_content);
       			if ($album_ids!='') {
       				// get the needed albums gallery id's
       				$albumRows = $wpdb->get_results ("SELECT sortorder, albumdesc FROM {$wpdb->prefix}ngg_album WHERE id IN (".$album_ids.")");
       				if (empty ($albumRows)) {
       				    return '';
       				}
       				else{
   
       					foreach ($albumRows as $albumRow) {
       						$imgNodeAlbum = str_replace('[img_caption]', $albumRow->albumdesc.' : [img_caption]', $imgNode);
       						$arrSortOrder = unserialize($albumRow->sortorder);
       						$gallery_delim_ids = '';
       						for($i=0; $i < count($arrSortOrder); $i++){
       							if($i != (count($arrSortOrder)-1)){
       								$gallery_delim_ids .= (int)$arrSortOrder[$i].", ";
       							}elseif($i == (count($arrSortOrder)-1)){
       								$gallery_delim_ids .= (int)$arrSortOrder[$i]."";
       							}
       						}
   
       						//$allImageTags .= "******** album ***".$album_ids."****GALLERY*******". $gallery_delim_ids."<br/>".$imgNodeAlbum."<br/>";
       						$allImageTags .= ks_get_image_Tags_for_gallery_IDs($gallery_delim_ids, $imgNodeAlbum);
       						//$content .= '<img src="http://'.$domain.'/'. $path->path .'/'. $pic->filename.'"><br> ';
       					}
   
       				}
   
       			}
       			else {
       				$gallery_ids = ks_get_ngg_gallery_ID_Matches($post->post_content);
       				$allImageTags .= ks_get_image_Tags_for_gallery_IDs($gallery_ids, $imgNode);
       			}
   
       		}
       		// ngg code - end
       	return $allImageTags;
       }
   
       function image_sitemap_loop () {
       	global $wpdb;
   
       	$posts = $wpdb->get_results ("SELECT id, post_parent, post_content, guid, post_type FROM $wpdb->posts wposts
                                            WHERE ((wposts.post_type = 'post') and (wposts.post_status='publish'))
                                            OR    ((wposts.post_type = 'page') and (wposts.post_status='publish'))
   
                                            OR    ((wposts.post_type = 'attachment') and (wposts.post_status='inherit'))
                                                  and ((wposts.post_mime_type = 'image/jpg') or (wposts.post_mime_type = 'image/gif')
                                                  or (wposts.post_mime_type = 'image/jpeg') or (wposts.post_mime_type = 'image/png'))
   
                                            ");
   
       	if (empty ($posts)) {
       	   return false;
       	} else {
                 $xml  = '<?xml version="1.0" encoding="UTF-8"?>'."\n";
                 $xml .= '<!-- Created by (http://wordpress.org/extend/plugins/google-image-sitemap/) -->'."\n";
                 $xml .= '<!-- Generated-on="'.date("F j, Y, g:i a").'" -->'."\n";
                 $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'."\n";
   
               foreach($posts as $post) {
       		$img='';
                       if($post->post_type == "attachment") {
       			if($post->post_parent != 0) {
       				$images[$post->post_parent][] = $post->guid;
       			}
                       }
       		else if(preg_match_all("/[\'\"](http:\/\/.[^\'\"]+\.(?:jpe?g|png|gif))[\'\"]/ui", $post->post_content, $matches, PREG_SET_ORDER)) {
       			foreach($matches as $match) {
       				$images[$post->id][] = $match[1];
       			}
                       }
   
       	        $img = ks_add_ngg_tags($post->post_content);
       		if ($img !=''){
       			$xml .= "<url><loc>" . EscapeXMLEntities($post->guid) . "</loc>" . $img . "</url>";
       		}
       	}     
   
       	foreach($images as $k => $v) {
                               $img='';
       			$permalink = get_permalink($k);
       			if ( ! empty ( $permalink ) ) {
       				$img = "<image:image><image:loc>".implode("</image:loc></image:image><image:image><image:loc>", $v)."</image:loc></image:image>";
                                       if ($img !=''){
       					$xml .= "<url><loc>" . EscapeXMLEntities($permalink) . "</loc>" . $img . "</url>";
       				}
       			}
       	}
   
                $xml .= "\n</urlset>";
               }
   
               $image_sitemap_url = $_SERVER["DOCUMENT_ROOT"].'/sitemap-image.xml';
               if(IsImageSitemapWritable($_SERVER["DOCUMENT_ROOT"]) || IsImageSitemapWritable($image_sitemap_url)) {
                   if(file_put_contents($image_sitemap_url, $xml)) {
                          return true;
                   }
               }
          return false;
        }
       ?>
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Old age issue with Sitemap :-(](https://wordpress.org/support/topic/old-age-issue-with-sitemap/)
 *  Thread Starter [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/old-age-issue-with-sitemap/#post-4463722)
 * Thanks Cias,
    The problem is just not with the album short code but even with
   gallery thumbnail view shortcode as well. I understand it is turning out to be
   a featured request. In the interim, it would be great if you can direct me in
   direction of changes that can result in a solution (preferably with Yoast). I
   will then contribute the solution to either plugin whichever requires modification.
   Thanks again!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Timely All-in-One Events Calendar] Problem with Google Calendar feed and maps](https://wordpress.org/support/topic/problem-with-google-calendar-feed-and-maps/)
 *  [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/problem-with-google-calendar-feed-and-maps/#post-4242722)
 * I see same thing happening on my site.
    lukejc1, did you find a solution to this?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Timely All-in-One Events Calendar] Display Featured Image On Calendar View](https://wordpress.org/support/topic/display-featured-image-on-calendar-view/)
 *  [Scorpious](https://wordpress.org/support/users/kuljit/)
 * (@kuljit)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/display-featured-image-on-calendar-view/#post-4333312)
 * I second this feature request.

Viewing 11 replies - 1 through 11 (of 11 total)