if permalink_structure doesn't have %category%, don't bother querying categories

git-svn-id: http://svn.automattic.com/wordpress/trunk@2355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
michelvaldrighi 2005-02-16 15:49:02 +00:00
parent b361854d4f
commit f547b70201
1 changed files with 6 additions and 3 deletions

View File

@ -54,9 +54,12 @@ function get_permalink($id = false) {
if ('' != $permalink) { if ('' != $permalink) {
$unixtime = strtotime($idpost->post_date); $unixtime = strtotime($idpost->post_date);
$category = '';
if (strstr($permalink, '%category%')) {
$cats = get_the_category($idpost->ID); $cats = get_the_category($idpost->ID);
$category = $cats[0]->category_nicename; $category = $cats[0]->category_nicename;
if ($parent=$cats[0]->category_parent) $category = get_category_parents($parent, FALSE, '/', TRUE) . $category; if ($parent=$cats[0]->category_parent) $category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
}
$authordata = get_userdata($idpost->post_author); $authordata = get_userdata($idpost->post_author);
$author = $authordata->user_nicename; $author = $authordata->user_nicename;