From 7b74d21f101c5195584b533dbf7d220fcead9d9a Mon Sep 17 00:00:00 2001 From: Anastasia Cheetham Date: Thu, 8 Dec 2011 14:00:32 -0500 Subject: [PATCH] STUDIO-9: Move the 'tag summary' code into functions.php; clean up whitespace. --- wp-content/themes/fluid-studios/archive.php | 4 +- wp-content/themes/fluid-studios/functions.php | 38 +++++++++++--- wp-content/themes/fluid-studios/header.php | 52 +++++++++---------- .../fluid-studios/inc/sidebar-common.php | 2 +- .../fluid-studios/inc/single-post-summary.php | 25 +-------- wp-content/themes/fluid-studios/index.php | 2 +- wp-content/themes/fluid-studios/page.php | 4 +- wp-content/themes/fluid-studios/search.php | 4 +- .../fluid-studios/sidebar-non-index.php | 2 +- wp-content/themes/fluid-studios/sidebar.php | 2 +- wp-content/themes/fluid-studios/single.php | 4 +- 11 files changed, 70 insertions(+), 69 deletions(-) diff --git a/wp-content/themes/fluid-studios/archive.php b/wp-content/themes/fluid-studios/archive.php index 64f04dc..6ab0488 100644 --- a/wp-content/themes/fluid-studios/archive.php +++ b/wp-content/themes/fluid-studios/archive.php @@ -63,9 +63,9 @@ - + - + diff --git a/wp-content/themes/fluid-studios/functions.php b/wp-content/themes/fluid-studios/functions.php index 2e5e705..2b24904 100644 --- a/wp-content/themes/fluid-studios/functions.php +++ b/wp-content/themes/fluid-studios/functions.php @@ -151,13 +151,37 @@ function enable_threaded_comments(){ // build an HTML string for a tag - function Studios_build_html($aTag) { - $tag_link = get_tag_link($aTag->term_id); - $html .= ""; - $html .= "{$aTag->name}"; - return $html; - } - + function Studios_build_html($aTag) { + $tag_link = get_tag_link($aTag->term_id); + $html .= ""; + $html .= "{$aTag->name}"; + return $html; + } +// Build a list of post tags limited to a maximum character length + function get_tags_summary($tagList) { + $html = ''; + if ($tagList) { + $html = '
'; + // always display at least the first tag + $firsttag = array_shift($tagList); + $html .= Studios_build_html($firsttag); + $display = "{$firsttag->name}"; + foreach($tagList as $tag) { + $newlen = strlen($display) + strlen($tag->name); + // only add next tag if it fits within the limit + if ($newlen < MAX_CHARS_IN_SUMMARY_TAG_LIST) { + $display .= ", {$tag->name}"; + $html .= ", ".Studios_build_html($tag); + } else { + // if there are undisplay tags, show ellipses + $html .= "..."; + break; + } + } + $html .= '
'; + } + return $html; + } ?> \ No newline at end of file diff --git a/wp-content/themes/fluid-studios/header.php b/wp-content/themes/fluid-studios/header.php index 78252a4..fd4c67e 100644 --- a/wp-content/themes/fluid-studios/header.php +++ b/wp-content/themes/fluid-studios/header.php @@ -61,10 +61,10 @@ >
- -
+ +
- +
@@ -74,30 +74,30 @@
diff --git a/wp-content/themes/fluid-studios/inc/sidebar-common.php b/wp-content/themes/fluid-studios/inc/sidebar-common.php index d55a0a1..587d46b 100644 --- a/wp-content/themes/fluid-studios/inc/sidebar-common.php +++ b/wp-content/themes/fluid-studios/inc/sidebar-common.php @@ -1,3 +1,3 @@ diff --git a/wp-content/themes/fluid-studios/inc/single-post-summary.php b/wp-content/themes/fluid-studios/inc/single-post-summary.php index 1d7f0bd..8b31cfb 100644 --- a/wp-content/themes/fluid-studios/inc/single-post-summary.php +++ b/wp-content/themes/fluid-studios/inc/single-post-summary.php @@ -17,30 +17,7 @@
- '; - // always display at least the first tag - $firsttag = array_shift($tags); - $html .= Studios_build_html($firsttag); - $display = "{$firsttag->name}"; - foreach($tags as $tag) { - $newlen = strlen($display) + strlen($tag->name); - // only add next tag if it fits within the limit - if ($newlen < MAX_CHARS_IN_SUMMARY_TAG_LIST) { - $display .= ", {$tag->name}"; - $html .= ", ".Studios_build_html($tag); - } else { - // if there are undisplay tags, show ellipses - $html .= "..."; - break; - } - } - $html .= '
'; - echo $html; - } - ?> + \ No newline at end of file diff --git a/wp-content/themes/fluid-studios/index.php b/wp-content/themes/fluid-studios/index.php index 3337a41..fde2aca 100644 --- a/wp-content/themes/fluid-studios/index.php +++ b/wp-content/themes/fluid-studios/index.php @@ -35,6 +35,6 @@ - + diff --git a/wp-content/themes/fluid-studios/page.php b/wp-content/themes/fluid-studios/page.php index e58c3f8..c075e70 100644 --- a/wp-content/themes/fluid-studios/page.php +++ b/wp-content/themes/fluid-studios/page.php @@ -32,8 +32,8 @@ - + - + diff --git a/wp-content/themes/fluid-studios/search.php b/wp-content/themes/fluid-studios/search.php index 214d5d5..8074db2 100644 --- a/wp-content/themes/fluid-studios/search.php +++ b/wp-content/themes/fluid-studios/search.php @@ -58,8 +58,8 @@ - + - + diff --git a/wp-content/themes/fluid-studios/sidebar-non-index.php b/wp-content/themes/fluid-studios/sidebar-non-index.php index bd43eb3..f01114f 100644 --- a/wp-content/themes/fluid-studios/sidebar-non-index.php +++ b/wp-content/themes/fluid-studios/sidebar-non-index.php @@ -1,4 +1,4 @@ -
+