diff --git a/docs/en_US/media-uploader.html b/docs/en_US/media-uploader.html index c111f6a..75dd82e 100644 --- a/docs/en_US/media-uploader.html +++ b/docs/en_US/media-uploader.html @@ -56,3 +56,27 @@


+ +

Sorting and Attaching Comic Images

+ +

+ Comic Image Sorter + + Once images are attached to a post, you can arrange them and associate sub-image types (such as RSS and Archive images) to their parent image. + The order in which images are sorted determines how they are returned by the M() function, and attaching new sub-images to a parent + image causes that attached image to replace the original in calls to EM(). +

+ +

+ To make them easier you see, you can adjust the image thumbnail size using the zoom slider on the left. +

+ +

+ If you attach new images using the Media Uploader, click the Refersh button to reload the ordering. Any changes not saved via Update post will be lost. +

+ +

+ The options shown are with the post attachment backend. Different backends may offer additional options from the ones presented here. +

+ +
diff --git a/docs/en_US/storyline-post-template-tags.html b/docs/en_US/storyline-post-template-tags.html index 1c2f9bb..4feb2a8 100644 --- a/docs/en_US/storyline-post-template-tags.html +++ b/docs/en_US/storyline-post-template-tags.html @@ -3,9 +3,9 @@

R() and RT()

- R() and RT() find posts that are relative to the current or provided post. - R() returns the found post, while RT() sets up the post so that you can use - standard WordPress template tags on the found posts as if it was part of the current Loop: + R() and RT() find posts that are relative to the current or provided post. + R() returns the found post, while RT() sets up the post so that you can use + standard WordPress template tags on the found posts as if it was part of the current Loop:

@@ -23,109 +23,109 @@ Restore(); // restore the saved Loop post
 

Basic Interactive Usage Sample

-

Mouse over each template tag on the right to see what post it will return relative to the Current Post.

+

Mouse over each template tag on the right to see what post it will return relative to the Current Post.

-
-
    -
  • R('first')
  • -
  • R('first', 'blog')
  • -
  • R('first', 'comic')
  • -
  • R('previous', 'blog')
  • -
  • R('previous', 'comic')
  • -
  • R('previous')
  • -
  • R('current')
  • -
  • R('next')
  • -
  • R('next', 'comic')
  • -
  • R('next', 'blog')
  • -
  • R('last', 'comic')
  • -
  • R('last', 'blog')
  • -
  • R('last')
  • -
-
+
+
    +
  • R('first')
  • +
  • R('first', 'blog')
  • +
  • R('first', 'comic')
  • +
  • R('previous', 'blog')
  • +
  • R('previous', 'comic')
  • +
  • R('previous')
  • +
  • R('current')
  • +
  • R('next')
  • +
  • R('next', 'comic')
  • +
  • R('next', 'blog')
  • +
  • R('last', 'comic')
  • +
  • R('last', 'blog')
  • +
  • R('last')
  • +
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Post NamePost DatePost Category
First in Blog2009-01-01Blog
First in Comic2009-01-02Comic
Previous in Blog2009-01-03Blog
Previous in Comic2009-01-04Comic
A Previous Extra Post2009-01-05Extra
Current Post2009-01-06Comic
A Next Extra Post2009-01-07Extra
Next in Comic2009-01-08Comic
Next in Blog2009-01-09Blog
Last in Comic2009-01-10Comic
Last in Blog2009-01-11Blog
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Post NamePost DatePost Category
First in Blog2009-01-01Blog
First in Comic2009-01-02Comic
Previous in Blog2009-01-03Blog
Previous in Comic2009-01-04Comic
A Previous Extra Post2009-01-05Extra
Current Post2009-01-06Comic
A Next Extra Post2009-01-07Extra
Next in Comic2009-01-08Comic
Next in Blog2009-01-09Blog
Last in Comic2009-01-10Comic
Last in Blog2009-01-11Blog
+

R() and RT() options

- Both R() and RT() accept up to three parameters: + Both R() and RT() accept up to three parameters:

@@ -149,25 +149,25 @@ R('previous', null, $other_post);
 

Valid strings

Valid array keys and values

- If you want a more sophisticated search, you can provide an array that, with each match, will add the matching categories to the search list. - You can preface any of the keys with an exclamation point to remove matches from the list. + If you want a more sophisticated search, you can provide an array that, with each match, will add the matching categories to the search list. + You can preface any of the keys with an exclamation point to remove matches from the list.

Protect(), Unprotect(), and Restore()

@@ -198,7 +198,7 @@ Unprotect();

- If you're using RT() tags to modify the current post, and need to work with the saved post, use Restore(): + If you're using RT() tags to modify the current post, and need to work with the saved post, use Restore():

@@ -235,3 +235,27 @@ if (apply_filters('comicpress-RT', 'last', array('child_of' => 'comic'))) {
 
 do_action('comicpress-Unprotect');
 
+ +

SL() and SC()

+ +

+ SL() and SC() give you access to the current storyline category information. + SL() lists all of the categories, in order, with the necessary metadata to traverse and understand the structure. + SC() lets you quickly traverse the storyline, returning category objects as it goes. +

+ +
+foreach (SL() as $category_id => $info) {
+  $category = get_category($category_id);
+  printf('Category %d is %d levels deep', $category->name, $info['level']);
+}
+
+// by default, SC() returns categories relative to the current post
+$next = SC('next');
+$previous = SC('previous');
+$parent = SC('parent');
+
+// or you can provide a category to be relative to
+$next_from_three = SC('next', 3);
+$previous_to_chapter_four = SC('previous', 'chapter-four');
+
\ No newline at end of file diff --git a/docs/images/comic-image-sorter.png b/docs/images/comic-image-sorter.png new file mode 100644 index 0000000..57d097e Binary files /dev/null and b/docs/images/comic-image-sorter.png differ diff --git a/functions.inc b/functions.inc index 2634d25..f477a58 100644 --- a/functions.inc +++ b/functions.inc @@ -174,7 +174,7 @@ function SL() { return $storyline->_structure; } -function SC($which, $relative_to = null) { +function SC($which = 'current', $relative_to = null) { global $post; $storyline = new ComicPressStoryline(); @@ -192,7 +192,12 @@ function SC($which, $relative_to = null) { } if (!is_null($relative_to)) { - if ($result = $storyline->_get_field($which, $relative_to)) { + if ($which == 'current') { + $result = $relative_to; + } else { + $result = $storyline->_get_field($which, $relative_to); + } + if ($result !== false) { $category = get_category($result); if (!empty($category)) { return $category; diff --git a/test/FunctionsTest.php b/test/FunctionsTest.php index 1cb5e72..896a8ad 100644 --- a/test/FunctionsTest.php +++ b/test/FunctionsTest.php @@ -195,6 +195,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { array('next', null, 3), array('next', 4, false), array('test', 4, false), + array('current', 1, 1), + array('current', null, 2), ); }