Friday, 27 December 2013

Google-sitemap-generator adding custom cateogry link for woocomerece


Folder of google-sitemap-generator in that open sitemap-ui.php file
Step-1
go at line no 1121 and press enter

add this code

<b><?php _e('Custom category types', 'sitemap') ?>:</b>
<ul>
 <li>
  <label for="sm_in_category">
  <input type="checkbox" id="sm_in_category" name="sm_in_category"  <?php echo ($this->sg->GetOption("in_category")==true?"checked=\"checked\"":"") ?> />
  <?php _e('Include custom Category', 'sitemap') ?>
  </label><br />
 </li>
</ul>

now save the file

step-2
open sitemap-core.php & inside function InitOptions()
at the line 892 add below line 

$this->_options["sm_in_category"]=false; //Include the category custom

step-3
now goto at line no 1992 in same file(sitemap-core.php) and below lines of code

//Add custom cateogry of woocommerece
if($this->GetOption("in_category")) {
$cats = get_terms("product_cat",array("hide_empty"=>1,'orderby' => 'ASC'));
 if($cats && is_array($cats) && count($cats)>0) {
  foreach($cats AS $cat) {
     $this->AddUrl(get_term_link( $cat->slug, $cat->taxonomy ),0,$this->GetOption("cf_cats"),$this->GetOption("pr_cats"));
  } 
 }
}

Save the file 
finshed