Changeset 1908 for trunk/wp-includes/template-functions-category.php
- Timestamp:
- 12/03/2004 02:38:11 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-category.php
r1853 r1908 26 26 27 27 function get_category_link($echo = false, $category_id, $category_nicename) { 28 global $wpdb, $post, $querystring_start, $querystring_equal, $cache_categories;28 global $wpdb, $wp_rewrite, $post, $querystring_start, $querystring_equal, $cache_categories; 29 29 $cat_ID = $category_id; 30 $ permalink_structure = get_settings('permalink_structure');30 $catlink = $wp_rewrite->get_category_permastruct(); 31 31 32 if ( '' == $permalink_structure) {32 if (empty($catlink)) { 33 33 $file = get_settings('home') . '/' . get_settings('blogfilename'); 34 $link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID; 35 } else { 36 $category_nicename = $cache_categories[$category_id]->category_nicename; 37 // Get any static stuff from the front 38 $front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); 39 if ( '' == get_settings('category_base') ) : 40 $link = get_settings('home') . $front . 'category/'; 41 else : 42 $link = get_settings('home') . get_settings('category_base') . '/'; 43 endif; 44 if ($parent=$cache_categories[$category_id]->category_parent) $link .= get_category_parents($parent, FALSE, '/', TRUE); 45 $link .= $category_nicename . '/'; 46 } 47 48 if ($echo) echo $link; 49 return $link; 34 $catlink = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID; 35 } else { 36 $category_nicename = $cache_categories[$category_id]->category_nicename; 37 if ($parent=$cache_categories[$category_id]->category_parent) $category_nicename = get_category_parents($parent, FALSE, '/', TRUE) . $category_nicename . '/'; 38 39 $catlink = str_replace('%category%', $category_nicename, $catlink); 40 $catlink = get_settings('home') . trailingslashit($catlink); 41 } 42 if ($echo) echo $catlink; 43 return $catlink; 50 44 } 51 45
Note: See TracChangeset
for help on using the changeset viewer.