extra_category_fields

Function to add extra category field.

Description

extra_category_fields( $tag ); 

Parameters (1)

0. $tag
The tag.

Usage

  1. if ( !function_exists( 'extra_category_fields' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-category-based-sitemaps/includes/wccs-functions.php'; 
  3.  
  4. // The tag. 
  5. $tag = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = extra_category_fields($tag); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wccs-functions.php  
  1. function extra_category_fields( $tag ) {  
  2. global $wccs_options; 
  3. $t_id = $tag->term_id; 
  4. $cat_meta = get_option( "category_$t_id"); 
  5. if ($cat_meta['priority'] == '') { 
  6. if ( (isset($wccs_options['catpriority'])) && ($wccs_options['catpriority'] != '' ) ) { 
  7. $cat_meta['priority']=$wccs_options['catpriority'];  
  8. } else { 
  9. $cat_meta['priority']='0.5'; 
  10. if ($cat_meta['change'] == '') { 
  11.  
  12. if ( (isset($wccs_options['catchange'])) && ($wccs_options['catchange'] != '' ) ) { 
  13. $cat_meta['change']=$wccs_options['catchange']; 
  14. } else { 
  15. $cat_meta['change']='monthly'; 
  16.  
  17. ?> 
  18.  
  19. <tr class="form-field"> 
  20. <th scope="row" valign="top"><label for="extra1"><?php 
  21. _e('Sitemap Priority'); ?></label></th> 
  22. <td> 
  23. <select id="Cat_meta[priority]" name="Cat_meta[priority]"> 
  24. <option value="0.0" <?php selected($cat_meta['priority'], '0.0'); ?>>0.0</option> 
  25. <option value="0.1" <?php selected($cat_meta['priority'], '0.1'); ?>>0.1</option> 
  26. <option value="0.2" <?php selected($cat_meta['priority'], '0.2'); ?>>0.2</option> 
  27. <option value="0.3" <?php selected($cat_meta['priority'], '0.3'); ?>>0.3</option> 
  28. <option value="0.4" <?php selected($cat_meta['priority'], '0.4'); ?>>0.4</option> 
  29. <option value="0.5" <?php selected($cat_meta['priority'], '0.5'); ?>>0.5</option> 
  30. <option value="0.6" <?php selected($cat_meta['priority'], '0.6'); ?>>0.6</option> 
  31. <option value="0.7" <?php selected($cat_meta['priority'], '0.7'); ?>>0.7</option> 
  32. <option value="0.8" <?php selected($cat_meta['priority'], '0.8'); ?>>0.8</option> 
  33. <option value="0.9" <?php selected($cat_meta['priority'], '0.9'); ?>>0.9</option> 
  34. <option value="1.0" <?php selected($cat_meta['priority'], '1.0'); ?>>1.0</option> 
  35. </select> 
  36. </td> 
  37. </tr> 
  38.  
  39.  
  40. <tr class="form-field" > 
  41. <th scope="row" valign="top"><label for="extra1"><?php 
  42. _e('Change Frequency'); ?></label></th> 
  43. <td><select id="Cat_meta[change]" name="Cat_meta[change]"> 
  44. <option value="always" <?php selected($cat_meta['change'], 'always'); ?>>Always</option> 
  45. <option value="hourly" <?php selected($cat_meta['change'], 'hourly'); ?>>Hourly</option> 
  46. <option value="daily" <?php selected($cat_meta['change'], 'daily'); ?>>Daily</option> 
  47. <option value="weekly" <?php selected($cat_meta['change'], 'weekly'); ?>>Weekly</option> 
  48. <option value="monthly" <?php selected($cat_meta['change'], 'monthly'); ?>>Monthly</option> 
  49. <option value="yearly" <?php selected($cat_meta['change'], 'yearly'); ?>>Yearly</option> 
  50. <option value="never" <?php selected($cat_meta['change'], 'never'); ?>>Never</option> 
  51. </select> </td> 
  52. </tr> 
  53. <tr class="form-field"> 
  54. <th scope="row" valign="top"><label for="Cat_meta[exclude]"><?php 
  55. _e('Always include this category into sitemap'); ?></label></th> 
  56. <td> 
  57. <select id="Cat_meta[exclude]" name="Cat_meta[exclude]"> 
  58. <option value="yes" <?php if ( (isset($cat_meta['exclude'])) && ($cat_meta['exclude'] == "yes") ) { echo "selected"; } ?>>YES</option> 
  59. <option value="no" <?php if ( (isset($cat_meta['exclude'])) && ($cat_meta['exclude'] == "no") ) { echo "selected"; } ?>>No</option> 
  60. </select> 
  61. </td> 
  62. </tr> 
  63. <?php 
  64. }