| 1 | Installation |
|---|
| 2 | ~~~~~~~~~~~~ |
|---|
| 3 | |
|---|
| 4 | 1. Drop the file in wordpress/wp-content/plugins |
|---|
| 5 | 2. Activate the plugin the WordPress Plugin Management |
|---|
| 6 | |
|---|
| 7 | If you have WordPress 1.2.x go to section WordPress 1.2.x |
|---|
| 8 | |
|---|
| 9 | If you have WordPress 1.5 continue: |
|---|
| 10 | |
|---|
| 11 | WordPress 1.5 |
|---|
| 12 | ~~~~~~~~~~~~~ |
|---|
| 13 | |
|---|
| 14 | 3. Insert one of the following code snippets into the sidebar |
|---|
| 15 | template. Which one is the right depends on the theme you are using. There are |
|---|
| 16 | two functions: |
|---|
| 17 | |
|---|
| 18 | get_recent_comments() - Show comments |
|---|
| 19 | get_recent_trackbacks() - Show trackbacks |
|---|
| 20 | |
|---|
| 21 | --------------------------------------------------------------- |
|---|
| 22 | Default Theme: wp-content/themes/default/sidebar.php |
|---|
| 23 | |
|---|
| 24 | <?php if (function_exists('get_recent_comments')) { ?> |
|---|
| 25 | <li><h2><?php _e('Recent Comments:'); ?></h2> |
|---|
| 26 | <ul> |
|---|
| 27 | <?php get_recent_comments(); ?> |
|---|
| 28 | </ul> |
|---|
| 29 | </li> |
|---|
| 30 | <?php } ?> |
|---|
| 31 | |
|---|
| 32 | <?php if (function_exists('get_recent_trackbacks')) { ?> |
|---|
| 33 | <li><h2><?php _e('Recent Trackbacks:'); ?></h2> |
|---|
| 34 | <ul> |
|---|
| 35 | <?php get_recent_trackbacks(); ?> |
|---|
| 36 | </ul> |
|---|
| 37 | </li> |
|---|
| 38 | <?php } ?> |
|---|
| 39 | --------------------------------------------------------------- |
|---|
| 40 | Classic Theme: wp-content/themes/classic/sidebar.php |
|---|
| 41 | |
|---|
| 42 | <?php if (function_exists('get_recent_comments')) { ?> |
|---|
| 43 | <li><?php _e('Recent Comments:'); ?> |
|---|
| 44 | <ul> |
|---|
| 45 | <?php get_recent_comments(); ?> |
|---|
| 46 | </ul> |
|---|
| 47 | </li> |
|---|
| 48 | <?php } ?> |
|---|
| 49 | |
|---|
| 50 | <?php if (function_exists('get_recent_trackbacks')) { ?> |
|---|
| 51 | <li><?php _e('Recent Trackbacks:'); ?> |
|---|
| 52 | <ul> |
|---|
| 53 | <?php get_recent_trackbacks(); ?> |
|---|
| 54 | </ul> |
|---|
| 55 | </li> |
|---|
| 56 | <?php } ?> |
|---|
| 57 | --------------------------------------------------------------- |
|---|
| 58 | |
|---|
| 59 | 4. (Optional) Set options in the admin gui: |
|---|
| 60 | Options/Recent Comments |
|---|
| 61 | |
|---|
| 62 | You can configure the number of Comments and Trackbacks, that are shown. And |
|---|
| 63 | you can set the length of the cited comments and specify a maximum word length. |
|---|
| 64 | Word longer than this value are wrapped, preventing them from damaging your |
|---|
| 65 | layout. |
|---|
| 66 | |
|---|
| 67 | Using macros you can customize the format of the cited comments and trackbacks. |
|---|
| 68 | %comment_excerpt The text of the comment. It might get shorted to the number of |
|---|
| 69 | characters you entered in "Long comments are chopped off at..." |
|---|
| 70 | |
|---|
| 71 | %comment_link The URL to the cited comment. |
|---|
| 72 | |
|---|
| 73 | %comment_author The name, the commenter entered in the comment form. If she |
|---|
| 74 | left the field empty, the name is "Anonymous". |
|---|
| 75 | |
|---|
| 76 | %comment_date The date, when the comment was posted in the style you configured |
|---|
| 77 | as default date format. |
|---|
| 78 | |
|---|
| 79 | %comment_time The time, when the comment was posted |
|---|
| 80 | |
|---|
| 81 | %author_url The URL, the comment author left in the comment form, or if the |
|---|
| 82 | comment is a trackback, the URL of the site that issued the |
|---|
| 83 | trackback. |
|---|
| 84 | |
|---|
| 85 | %post_title The title of the posting that was commented. |
|---|
| 86 | |
|---|
| 87 | %post_link The URL of the posting that was commented. |
|---|
| 88 | |
|---|
| 89 | %post_date The date when the commented posting was published. |
|---|
| 90 | |
|---|
| 91 | %trackback_title Only applicable in trackbacks: The title of the trackback. It |
|---|
| 92 | might get shorted to the number of characters you entered in |
|---|
| 93 | "Long trackbacks are chopped off at..." |
|---|
| 94 | |
|---|
| 95 | WordPress 1.2.x |
|---|
| 96 | ~~~~~~~~~~~~~~~ |
|---|
| 97 | |
|---|
| 98 | 3. Write the following piece of code into your template (index.php) |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | <li id="recent_comments"><?php _e('Recent Comments:'); ?> |
|---|
| 102 | <ul> |
|---|
| 103 | <? get_recent_comments(); ?> |
|---|
| 104 | </ul> |
|---|
| 105 | </li> |
|---|
| 106 | |
|---|
| 107 | Done. If you want more, read on... |
|---|
| 108 | |
|---|
| 109 | WordPress 1.2.x Advanced configuration |
|---|
| 110 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 111 | |
|---|
| 112 | 4. (Optional) |
|---|
| 113 | You can specify one to three arguments to the function. It is possible to |
|---|
| 114 | name only one argument or only two. Look at the following examples. |
|---|
| 115 | |
|---|
| 116 | The arguments have the following meaning: |
|---|
| 117 | 1. Number of comments to display. |
|---|
| 118 | 2. Maximum Number of characters in a comment excerpt |
|---|
| 119 | 3. Formatting |
|---|
| 120 | |
|---|
| 121 | If you don't specify arguments the plugin defaults to 5 comments, 120 |
|---|
| 122 | characters per comment and a standard formatting. |
|---|
| 123 | |
|---|
| 124 | The format is a piece of html code where you use tags that will be replaced |
|---|
| 125 | by the actual data: |
|---|
| 126 | |
|---|
| 127 | %comment_excerpt - Shortened comment. |
|---|
| 128 | %comment_link - Link to the comment. Something like: |
|---|
| 129 | http://blog.example.com/wp/archives/2005/02/03/this-is-a-test/#comment-523 |
|---|
| 130 | %comment_author - Name left by the commenter |
|---|
| 131 | %comment_date - Date of comment |
|---|
| 132 | %comment_time - Time of comment |
|---|
| 133 | %post_title - Title of the posting |
|---|
| 134 | %post_link - Link to the posting (and not the comment). Something like: |
|---|
| 135 | http://blog.example.com/wp/archives/2005/02/03/this-is-a-test/ |
|---|
| 136 | %post_date - Date of the posting |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | WordPress 1.2.x Examples |
|---|
| 140 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 141 | |
|---|
| 142 | Show the 8 most recent comments |
|---|
| 143 | <?php get_recent_comments(8); ?> |
|---|
| 144 | |
|---|
| 145 | Show the 8 most recent comments, with a maximum of 100 characters per comment: |
|---|
| 146 | <?php get_recent_comments(8,100); ?> |
|---|
| 147 | |
|---|
| 148 | The same with your own formatting |
|---|
| 149 | <?php get_recent_comments(8,100,'<li><a href="%comment_link">%comment_author</a>: %comment_excerpt</li>'); |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | |
|---|
| 153 | Feedback |
|---|
| 154 | ~~~~~~~~ |
|---|
| 155 | |
|---|
| 156 | krischan@jodies.de |
|---|
| 157 | http://blog.jodies.de |
|---|
| 158 | |
|---|
| 159 | |
|---|