Related Posts Thumbnails Plugin for WordPress - Version 1.2

Version Description

  • added php tag for use in theme
  • added option to turn off automatic appending
  • set title length 0 for no title
  • added excerpt
  • added sidebar widget
  • added shortcode
Download this release

Release Info

Developer marynixie
Plugin Icon 128x128 Related Posts Thumbnails Plugin for WordPress
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.2

locale/related-posts-thumbnails-ru_RU.mo CHANGED
Binary file
locale/related-posts-thumbnails-ru_RU.po CHANGED
@@ -7,7 +7,7 @@ msgstr ""
7
  "Project-Id-Version: Related Posts Thubmnails 1.0\n"
8
  "Report-Msgid-Bugs-To: \n"
9
  "POT-Creation-Date: 2010-05-19 17:17-0700\n"
10
- "PO-Revision-Date: 2010-05-24 17:21-0700\n"
11
  "Last-Translator: M.Shaldybina <mary@shaldybina.com>\n"
12
  "Language-Team: ru_RU <mary@shaldybina.com>\n"
13
  "Language: ru_RU\n"
@@ -20,26 +20,32 @@ msgstr ""
20
  "X-Poedit-SourceCharset: utf-8\n"
21
 
22
  #: related-posts-thumbnails.php:148 related-posts-thumbnails.php:194
 
23
  msgid "Related Posts Thumbnails"
24
  msgstr "Миниатюры похожих записей"
25
 
26
  #: related-posts-thumbnails.php:148 related-posts-thumbnails.php:194
 
27
  msgid "Related Posts Thumbs"
28
  msgstr "Похожие записи"
29
 
30
  #: related-posts-thumbnails.php:154 related-posts-thumbnails.php:200
 
31
  msgid "No access"
32
  msgstr "Нет доступа"
33
 
34
  #: related-posts-thumbnails.php:170 related-posts-thumbnails.php:222
 
35
  msgid "Settings updated"
36
  msgstr "Настройки обновлены"
37
 
38
  #: related-posts-thumbnails.php:182 related-posts-thumbnails.php:239
 
39
  msgid "Related Posts Thumbnails Settings"
40
  msgstr "Настройки миниатюр похожих записей"
41
 
42
  #: related-posts-thumbnails.php:188 related-posts-thumbnails.php:245
 
43
  msgid "General Display Options"
44
  msgstr "Общие свойства отображения"
45
 
@@ -48,67 +54,84 @@ msgid "Display options"
48
  msgstr "Параметр отображения"
49
 
50
  #: related-posts-thumbnails.php:194 related-posts-thumbnails.php:251
 
51
  msgid "Show on single posts only"
52
  msgstr "Показывать только на отдельной странице"
53
 
54
  #: related-posts-thumbnails.php:198 related-posts-thumbnails.php:280
 
55
  msgid "Top text"
56
  msgstr "Верхний текст"
57
 
58
  #: related-posts-thumbnails.php:204 related-posts-thumbnails.php:286
 
59
  msgid "Number of similar posts to display"
60
  msgstr "Количество похожих записей для отображения"
61
 
62
  #: related-posts-thumbnails.php:212 related-posts-thumbnails.php:360
 
63
  msgid "Style options"
64
  msgstr "Опции стиля"
65
 
66
  #: related-posts-thumbnails.php:215 related-posts-thumbnails.php:363
 
67
  msgid "Background color"
68
  msgstr "Цвет заднего фона"
69
 
70
  #: related-posts-thumbnails.php:221 related-posts-thumbnails.php:369
 
71
  msgid "Background color on mouse over"
72
  msgstr "Цвет заднего фона при наведении курсора"
73
 
74
  #: related-posts-thumbnails.php:227 related-posts-thumbnails.php:375
 
75
  msgid "Border color"
76
  msgstr "Цвет границы"
77
 
78
  #: related-posts-thumbnails.php:233 related-posts-thumbnails.php:381
 
79
  msgid "Font color"
80
  msgstr "Цвет шрифта"
81
 
82
  #: related-posts-thumbnails.php:239 related-posts-thumbnails.php:387
 
83
  msgid "Font family"
84
  msgstr "Стиль шрифта"
85
 
86
  #: related-posts-thumbnails.php:245 related-posts-thumbnails.php:393
 
87
  msgid "Font size"
88
  msgstr "Размер шрифта"
89
 
90
  #: related-posts-thumbnails.php:251 related-posts-thumbnails.php:399
 
91
  msgid "Text maximum length"
92
  msgstr "Максимальная длина текста"
93
 
94
  #: related-posts-thumbnails.php:259 related-posts-thumbnails.php:407
 
95
  msgid "Relation Builder Options"
96
  msgstr "Настройки связей"
97
 
98
  #: related-posts-thumbnails.php:262 related-posts-thumbnails.php:410
 
99
  msgid "Relation based on"
100
  msgstr "Связи расчитываются на основе"
101
 
102
  #: related-posts-thumbnails.php:265 related-posts-thumbnails.php:255
103
- #: related-posts-thumbnails.php:413
 
 
104
  msgid "Categories"
105
  msgstr "Категории"
106
 
107
  #: related-posts-thumbnails.php:267 related-posts-thumbnails.php:415
 
108
  msgid "Tags"
109
  msgstr "Метки"
110
 
111
  #: related-posts-thumbnails.php:269 related-posts-thumbnails.php:417
 
112
  msgid "Categories and Tags"
113
  msgstr "Категории и метки"
114
 
@@ -117,57 +140,106 @@ msgid "Thumbnails options"
117
  msgstr "Настройки миниатюр"
118
 
119
  #: related-posts-thumbnails.php:278 related-posts-thumbnails.php:327
 
120
  msgid "Post-thumbnails name"
121
  msgstr "Название миниатюры"
122
 
123
  #: related-posts-thumbnails.php:286 related-posts-thumbnails.php:335
 
124
  msgid "Your theme has to support post-thumbnails to have more choices"
125
  msgstr ""
126
  "Для более широкого выбора размеров, ваша тема должна поддерживать post-"
127
  "thumbnails"
128
 
129
  #: related-posts-thumbnails.php:291 related-posts-thumbnails.php:292
 
130
  msgid "Default image URL"
131
  msgstr "Ссылка на картинку по умолчанию, в случае, если нет миниатюры"
132
 
133
  #: related-posts-thumbnails.php:299 related-posts-thumbnails.php:422
 
134
  msgid "Save Changes"
135
  msgstr "Сохранить изменения"
136
 
137
- #: related-posts-thumbnails.php:248
 
138
  msgid "Page type"
139
  msgstr "Тип страницы"
140
 
141
- #: related-posts-thumbnails.php:270
 
142
  msgid "All"
143
  msgstr "Все"
144
 
145
  #: related-posts-thumbnails.php:298 related-posts-thumbnails.php:324
146
- #: related-posts-thumbnails.php:342
 
 
 
147
  msgid "Thumbnails source"
148
  msgstr "Источник миниатюр"
149
 
150
- #: related-posts-thumbnails.php:345
 
151
  msgid "Custom field name"
152
  msgstr "Название произвольного поля"
153
 
154
- #: related-posts-thumbnails.php:351
 
155
  msgid "Size"
156
  msgstr "Размер"
157
 
158
- #: related-posts-thumbnails.php:353
 
159
  msgid "Width"
160
  msgstr "Ширина"
161
 
162
- #: related-posts-thumbnails.php:354
 
163
  msgid "Height"
164
  msgstr "Высота"
165
 
166
- #: related-posts-thumbnails.php:426
 
167
  msgid ""
168
  "If you experience some problems with this plugin please let me know about it "
169
  "on <a href=\"http://wordpress.shaldybina.com/plugins/related-posts-"
170
  "thumbnails/\">Plugin's homepage</a>. If you think this plugin is awesome "
171
  "please vote on <a href=\"http://wordpress.org/extend/plugins/related-posts-"
172
  "thumbnails/\">Wordpress plugin page</a>. Thanks!"
173
- msgstr "Пожалуйста сообщайте об ошибках на <a href=\"http://wordpress.shaldybina.com/plugins/related-posts-thumbnails/\">домашней странице плагина</a>. Если вам понравился плагин, пожалуйста <a href=\"http://wordpress.org/extend/plugins/related-posts-thumbnails/\">проголосуйте</a>. Спасибо!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  "Project-Id-Version: Related Posts Thubmnails 1.0\n"
8
  "Report-Msgid-Bugs-To: \n"
9
  "POT-Creation-Date: 2010-05-19 17:17-0700\n"
10
+ "PO-Revision-Date: 2010-06-10 18:12-0700\n"
11
  "Last-Translator: M.Shaldybina <mary@shaldybina.com>\n"
12
  "Language-Team: ru_RU <mary@shaldybina.com>\n"
13
  "Language: ru_RU\n"
20
  "X-Poedit-SourceCharset: utf-8\n"
21
 
22
  #: related-posts-thumbnails.php:148 related-posts-thumbnails.php:194
23
+ #: related-posts-thumbnails.php:231 related-posts-thumbnails.php:232
24
  msgid "Related Posts Thumbnails"
25
  msgstr "Миниатюры похожих записей"
26
 
27
  #: related-posts-thumbnails.php:148 related-posts-thumbnails.php:194
28
+ #: related-posts-thumbnails.php:231 related-posts-thumbnails.php:232
29
  msgid "Related Posts Thumbs"
30
  msgstr "Похожие записи"
31
 
32
  #: related-posts-thumbnails.php:154 related-posts-thumbnails.php:200
33
+ #: related-posts-thumbnails.php:237 related-posts-thumbnails.php:238
34
  msgid "No access"
35
  msgstr "Нет доступа"
36
 
37
  #: related-posts-thumbnails.php:170 related-posts-thumbnails.php:222
38
+ #: related-posts-thumbnails.php:261 related-posts-thumbnails.php:263
39
  msgid "Settings updated"
40
  msgstr "Настройки обновлены"
41
 
42
  #: related-posts-thumbnails.php:182 related-posts-thumbnails.php:239
43
+ #: related-posts-thumbnails.php:281 related-posts-thumbnails.php:283
44
  msgid "Related Posts Thumbnails Settings"
45
  msgstr "Настройки миниатюр похожих записей"
46
 
47
  #: related-posts-thumbnails.php:188 related-posts-thumbnails.php:245
48
+ #: related-posts-thumbnails.php:287 related-posts-thumbnails.php:289
49
  msgid "General Display Options"
50
  msgstr "Общие свойства отображения"
51
 
54
  msgstr "Параметр отображения"
55
 
56
  #: related-posts-thumbnails.php:194 related-posts-thumbnails.php:251
57
+ #: related-posts-thumbnails.php:300 related-posts-thumbnails.php:302
58
  msgid "Show on single posts only"
59
  msgstr "Показывать только на отдельной странице"
60
 
61
  #: related-posts-thumbnails.php:198 related-posts-thumbnails.php:280
62
+ #: related-posts-thumbnails.php:329 related-posts-thumbnails.php:331
63
  msgid "Top text"
64
  msgstr "Верхний текст"
65
 
66
  #: related-posts-thumbnails.php:204 related-posts-thumbnails.php:286
67
+ #: related-posts-thumbnails.php:335 related-posts-thumbnails.php:337
68
  msgid "Number of similar posts to display"
69
  msgstr "Количество похожих записей для отображения"
70
 
71
  #: related-posts-thumbnails.php:212 related-posts-thumbnails.php:360
72
+ #: related-posts-thumbnails.php:409 related-posts-thumbnails.php:411
73
  msgid "Style options"
74
  msgstr "Опции стиля"
75
 
76
  #: related-posts-thumbnails.php:215 related-posts-thumbnails.php:363
77
+ #: related-posts-thumbnails.php:412 related-posts-thumbnails.php:414
78
  msgid "Background color"
79
  msgstr "Цвет заднего фона"
80
 
81
  #: related-posts-thumbnails.php:221 related-posts-thumbnails.php:369
82
+ #: related-posts-thumbnails.php:418 related-posts-thumbnails.php:420
83
  msgid "Background color on mouse over"
84
  msgstr "Цвет заднего фона при наведении курсора"
85
 
86
  #: related-posts-thumbnails.php:227 related-posts-thumbnails.php:375
87
+ #: related-posts-thumbnails.php:424 related-posts-thumbnails.php:426
88
  msgid "Border color"
89
  msgstr "Цвет границы"
90
 
91
  #: related-posts-thumbnails.php:233 related-posts-thumbnails.php:381
92
+ #: related-posts-thumbnails.php:430 related-posts-thumbnails.php:432
93
  msgid "Font color"
94
  msgstr "Цвет шрифта"
95
 
96
  #: related-posts-thumbnails.php:239 related-posts-thumbnails.php:387
97
+ #: related-posts-thumbnails.php:436 related-posts-thumbnails.php:438
98
  msgid "Font family"
99
  msgstr "Стиль шрифта"
100
 
101
  #: related-posts-thumbnails.php:245 related-posts-thumbnails.php:393
102
+ #: related-posts-thumbnails.php:442 related-posts-thumbnails.php:444
103
  msgid "Font size"
104
  msgstr "Размер шрифта"
105
 
106
  #: related-posts-thumbnails.php:251 related-posts-thumbnails.php:399
107
+ #: related-posts-thumbnails.php:448 related-posts-thumbnails.php:450
108
  msgid "Text maximum length"
109
  msgstr "Максимальная длина текста"
110
 
111
  #: related-posts-thumbnails.php:259 related-posts-thumbnails.php:407
112
+ #: related-posts-thumbnails.php:464 related-posts-thumbnails.php:472
113
  msgid "Relation Builder Options"
114
  msgstr "Настройки связей"
115
 
116
  #: related-posts-thumbnails.php:262 related-posts-thumbnails.php:410
117
+ #: related-posts-thumbnails.php:467 related-posts-thumbnails.php:475
118
  msgid "Relation based on"
119
  msgstr "Связи расчитываются на основе"
120
 
121
  #: related-posts-thumbnails.php:265 related-posts-thumbnails.php:255
122
+ #: related-posts-thumbnails.php:413 related-posts-thumbnails.php:304
123
+ #: related-posts-thumbnails.php:470 related-posts-thumbnails.php:306
124
+ #: related-posts-thumbnails.php:478
125
  msgid "Categories"
126
  msgstr "Категории"
127
 
128
  #: related-posts-thumbnails.php:267 related-posts-thumbnails.php:415
129
+ #: related-posts-thumbnails.php:472 related-posts-thumbnails.php:480
130
  msgid "Tags"
131
  msgstr "Метки"
132
 
133
  #: related-posts-thumbnails.php:269 related-posts-thumbnails.php:417
134
+ #: related-posts-thumbnails.php:474 related-posts-thumbnails.php:482
135
  msgid "Categories and Tags"
136
  msgstr "Категории и метки"
137
 
140
  msgstr "Настройки миниатюр"
141
 
142
  #: related-posts-thumbnails.php:278 related-posts-thumbnails.php:327
143
+ #: related-posts-thumbnails.php:376 related-posts-thumbnails.php:378
144
  msgid "Post-thumbnails name"
145
  msgstr "Название миниатюры"
146
 
147
  #: related-posts-thumbnails.php:286 related-posts-thumbnails.php:335
148
+ #: related-posts-thumbnails.php:384 related-posts-thumbnails.php:386
149
  msgid "Your theme has to support post-thumbnails to have more choices"
150
  msgstr ""
151
  "Для более широкого выбора размеров, ваша тема должна поддерживать post-"
152
  "thumbnails"
153
 
154
  #: related-posts-thumbnails.php:291 related-posts-thumbnails.php:292
155
+ #: related-posts-thumbnails.php:341 related-posts-thumbnails.php:343
156
  msgid "Default image URL"
157
  msgstr "Ссылка на картинку по умолчанию, в случае, если нет миниатюры"
158
 
159
  #: related-posts-thumbnails.php:299 related-posts-thumbnails.php:422
160
+ #: related-posts-thumbnails.php:479 related-posts-thumbnails.php:487
161
  msgid "Save Changes"
162
  msgstr "Сохранить изменения"
163
 
164
+ #: related-posts-thumbnails.php:248 related-posts-thumbnails.php:297
165
+ #: related-posts-thumbnails.php:299
166
  msgid "Page type"
167
  msgstr "Тип страницы"
168
 
169
+ #: related-posts-thumbnails.php:270 related-posts-thumbnails.php:319
170
+ #: related-posts-thumbnails.php:321
171
  msgid "All"
172
  msgstr "Все"
173
 
174
  #: related-posts-thumbnails.php:298 related-posts-thumbnails.php:324
175
+ #: related-posts-thumbnails.php:342 related-posts-thumbnails.php:347
176
+ #: related-posts-thumbnails.php:373 related-posts-thumbnails.php:391
177
+ #: related-posts-thumbnails.php:349 related-posts-thumbnails.php:375
178
+ #: related-posts-thumbnails.php:393
179
  msgid "Thumbnails source"
180
  msgstr "Источник миниатюр"
181
 
182
+ #: related-posts-thumbnails.php:345 related-posts-thumbnails.php:394
183
+ #: related-posts-thumbnails.php:396
184
  msgid "Custom field name"
185
  msgstr "Название произвольного поля"
186
 
187
+ #: related-posts-thumbnails.php:351 related-posts-thumbnails.php:400
188
+ #: related-posts-thumbnails.php:402
189
  msgid "Size"
190
  msgstr "Размер"
191
 
192
+ #: related-posts-thumbnails.php:353 related-posts-thumbnails.php:402
193
+ #: related-posts-thumbnails.php:404
194
  msgid "Width"
195
  msgstr "Ширина"
196
 
197
+ #: related-posts-thumbnails.php:354 related-posts-thumbnails.php:403
198
+ #: related-posts-thumbnails.php:405
199
  msgid "Height"
200
  msgstr "Высота"
201
 
202
+ #: related-posts-thumbnails.php:426 related-posts-thumbnails.php:483
203
+ #: related-posts-thumbnails.php:491
204
  msgid ""
205
  "If you experience some problems with this plugin please let me know about it "
206
  "on <a href=\"http://wordpress.shaldybina.com/plugins/related-posts-"
207
  "thumbnails/\">Plugin's homepage</a>. If you think this plugin is awesome "
208
  "please vote on <a href=\"http://wordpress.org/extend/plugins/related-posts-"
209
  "thumbnails/\">Wordpress plugin page</a>. Thanks!"
210
+ msgstr ""
211
+ "Пожалуйста сообщайте об ошибках на <a href=\"http://wordpress.shaldybina.com/"
212
+ "plugins/related-posts-thumbnails/\">домашней странице плагина</a>. Если вам "
213
+ "понравился плагин, пожалуйста <a href=\"http://wordpress.org/extend/plugins/"
214
+ "related-posts-thumbnails/\">проголосуйте</a>. Спасибо!"
215
+
216
+ #: related-posts-thumbnails.php:290 related-posts-thumbnails.php:292
217
+ msgid "Automatically append to the post content"
218
+ msgstr ""
219
+
220
+ #: related-posts-thumbnails.php:293 related-posts-thumbnails.php:295
221
+ msgid ""
222
+ "Or use <b>&lt;?php get_related_posts_thumbnails(); ?&gt;</b> in the Loop"
223
+ msgstr ""
224
+ "Или используйте <b>&lt;php get_related_posts_thumbnails(); ?&gt;</b> в цикле "
225
+ "темы"
226
+
227
+ #: related-posts-thumbnails.php:451 related-posts-thumbnails.php:453
228
+ msgid "Set 0 for no title"
229
+ msgstr "Поставьте 0, чтобы не отображать заголовок"
230
+
231
+ #: related-posts-thumbnails.php:455 related-posts-thumbnails.php:457
232
+ msgid "Excerpt maximum length"
233
+ msgstr "Максимальная длина цитаты"
234
+
235
+ #: related-posts-thumbnails.php:458 related-posts-thumbnails.php:460
236
+ msgid "Set 0 for no excerpt"
237
+ msgstr "Поставьте 0, чтобы не отображать цитату"
238
+
239
+ #: related-posts-thumbnails.php:530 related-posts-thumbnails.php:538
240
+ msgid "Title:"
241
+ msgstr "Заголовок:"
242
+
243
+ #: related-posts-thumbnails.php:464
244
+ msgid "Text block height"
245
+ msgstr "Высота текстового блока"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpress.shaldybina.com/donate
4
  Tags: related, posts, thumbnail
5
  Requires at least: 2.9
6
  Tested up to: 2.9.2
7
- Stable tag: 1.1.1
8
 
9
  Customizable plugin, that nicely displays related posts thumbnails under the post.
10
 
@@ -14,9 +14,9 @@ This plugin will add related posts thumbnails after the post. Plugin allows to c
14
 
15
  By default it uses generated by Wordpress thumbnail for the first image appeared in the post, that was uploaded on the server with sizes as set in Media settings. You can select between 'thumbnail' and 'medium' size options. In addition if your theme supports Post Thumbnails feature introduced in Wordpress 2.9 you can specify custom thumbnail size. You can also specify post custom field name to be used as thumbnails source.
16
 
17
- Thumbnails are arranged in columns under the post with related posts title under each post thumbnail. Colors of background, border, text, text sizes and background on mouse over can be customized. See screenshot.
18
 
19
- You can specify number of related posts to display, top text, style settings, default image URL. You can select type of relation - categories, tags or categories and tags. You can where to display related posts - specify page type (main or single) and select categories.
20
 
21
  Related Links:
22
 
@@ -42,9 +42,9 @@ If your theme does not support Post Thumbnail feature or post has no assigned th
42
 
43
  = Does plugin support external images, e.g. uploaded on Flickr? =
44
 
45
- There is no such support in the current version of the plugin.
46
 
47
- = What is default image URL? =
48
 
49
  If there are no images of the specified size in the post, or file does not exist on the server the default image will be used as a post thumbnail. You can upload your image on server and specify its URL in plugin settings.
50
 
@@ -55,6 +55,14 @@ If there are no images of the specified size in the post, or file does not exist
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
 
 
58
  = 1.1.1 =
59
  * removed PHP warning on settings page somebody may experience
60
  * full HTML support in top text field
@@ -70,6 +78,9 @@ If there are no images of the specified size in the post, or file does not exist
70
 
71
  == Upgrade Notice ==
72
 
 
 
 
73
  = 1.1.1 =
74
  This version includes elimination of warning on settings page some may experience, plus full html support in top text field.
75
 
4
  Tags: related, posts, thumbnail
5
  Requires at least: 2.9
6
  Tested up to: 2.9.2
7
+ Stable tag: 1.2
8
 
9
  Customizable plugin, that nicely displays related posts thumbnails under the post.
10
 
14
 
15
  By default it uses generated by Wordpress thumbnail for the first image appeared in the post, that was uploaded on the server with sizes as set in Media settings. You can select between 'thumbnail' and 'medium' size options. In addition if your theme supports Post Thumbnails feature introduced in Wordpress 2.9 you can specify custom thumbnail size. You can also specify post custom field name to be used as thumbnails source.
16
 
17
+ Thumbnails are arranged in columns under the post with related posts title/excerpt under each post thumbnail. Colors of background, border, text, text sizes, background on mouse over, title and excerpt length can be customized. See screenshot.
18
 
19
+ You can specify number of related posts to display, top text, style settings, default image URL. You can select type of relation - categories, tags or categories and tags. You can specify where to display related posts - choose page type (main or single) and select categories. You can turn off automatic appending to the end of post and use **&lt;?php get_related_posts_thumbnails(); ?&gt;** php tag in the Loop of your theme. Related Posts thumbnails sidebar widget is also available. You can use [related-posts-thumbnails] shortcode in the post body.
20
 
21
  Related Links:
22
 
42
 
43
  = Does plugin support external images, e.g. uploaded on Flickr? =
44
 
45
+ There is no direct support of external images in the current version of the plugin. You can use custom field option. Or you can use http://wordpress.org/extend/plugins/generate-post-thumbnails/ or similar plugin to save external images as post thumbnails.
46
 
47
+ = What is the default image URL? =
48
 
49
  If there are no images of the specified size in the post, or file does not exist on the server the default image will be used as a post thumbnail. You can upload your image on server and specify its URL in plugin settings.
50
 
55
 
56
  == Changelog ==
57
 
58
+ = 1.2 =
59
+ * added php tag for use in theme
60
+ * added option to turn off automatic appending
61
+ * set title length 0 for no title
62
+ * added excerpt
63
+ * added sidebar widget
64
+ * added shortcode
65
+
66
  = 1.1.1 =
67
  * removed PHP warning on settings page somebody may experience
68
  * full HTML support in top text field
78
 
79
  == Upgrade Notice ==
80
 
81
+ = 1.2 =
82
+ This version supports php tag, title and excerpt length, sidebar widget.
83
+
84
  = 1.1.1 =
85
  This version includes elimination of warning on settings page some may experience, plus full html support in top text field.
86
 
related-posts-thumbnails.php CHANGED
@@ -2,7 +2,7 @@
2
  Plugin Name: Related Posts Thumbnails
3
  Plugin URI: http://wordpress.shaldybina.com/plugins/related-posts-thumbnails/
4
  Description: Showing related posts thumbnails under the post.
5
- Version: 1.1.1
6
  Author: Maria Shaldybina
7
  Author URI: http://shaldybina.com/
8
  */
@@ -22,6 +22,7 @@ class RelatedPostsThumbnails {
22
 
23
  /* Default values */
24
  public $single_only = '1';
 
25
  public $top_text = '<h3>Related posts:</h3>';
26
  public $number = 3;
27
  public $relation = 'categories';
@@ -34,28 +35,34 @@ class RelatedPostsThumbnails {
34
  public $font_family = 'Arial';
35
  public $font_size = '12';
36
  public $text_length = '100';
 
37
  public $custom_field = '';
38
  public $custom_height = '100';
39
  public $custom_width = '100';
 
40
  public $thsource = 'post-thumbnails';
41
  public $categories_all = '1';
42
 
43
  function RelatedPostsThumbnails() { // initialization
44
  load_plugin_textdomain( 'related-posts-thumbnails', false, basename( dirname( __FILE__ ) ) . '/locale' );
45
  $this->default_image = WP_PLUGIN_URL . '/related-posts-thumbnails/img/default.png';
46
- add_filter( 'the_content', array( $this, 'relpoststh_show' ) );
 
47
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
 
48
  }
49
 
50
- function relpoststh_show( $content ) { // Displaying related posts on the site
51
- if ( $this->is_relpoststh_show() ) {
52
- $content .= stripslashes( get_option( 'relpoststh_top_text', $this->top_text ) );
53
- $content .= $this->relpoststh_get();
54
- }
55
- return $content;
 
 
56
  }
57
 
58
- function relpoststh_get() { // Retrieve Related Posts HTML for output
59
  $id = get_the_ID();
60
  $relation = get_option( 'relpoststh_relation', $this->relation );
61
  $posts_number = get_option( 'relpoststh_number', $this->number );
@@ -64,6 +71,7 @@ class RelatedPostsThumbnails {
64
  }
65
  $poststhname = get_option( 'relpoststh_poststhname', $this->poststhname );
66
  $text_length = get_option( 'relpoststh_textlength', $this->text_length );
 
67
  $thsource = get_option( 'relpoststh_thsource', $this->thsource );
68
  $categories_all = get_option( 'relpoststh_categoriesall', $this->categories_all );
69
  $posts = array();
@@ -128,10 +136,10 @@ class RelatedPostsThumbnails {
128
  // displaying square if one size is not cropping
129
  if ( $height == 9999 )
130
  $height = $width;
131
- if ( $width == 9999 )
132
  $width = $height;
133
  // theme is not supporting but settings were not changed
134
- if ( empty( $width ) )
135
  $width = get_option( "thumbnail_size_w" );
136
  if ( empty( $height ) )
137
  $height = get_option( "thumbnail_size_h" );
@@ -170,11 +178,19 @@ class RelatedPostsThumbnails {
170
  if ( empty( $url ) || false === @fopen( $url, 'r' ) ) { // using default image if no image was found or no such file on server
171
  $url = get_option( 'relpoststh_default_image', $this->default_image );
172
  }
173
- $title = ( strlen( $post->post_title ) > $text_length ) ? substr( $post->post_title, 0, $text_length) . '...' : $post->post_title;
 
 
 
 
 
 
 
 
174
  $output .= '<a onmouseout="this.style.backgroundColor=\'' . get_option( 'relpoststh_background', $this->background ) . '\'" onmouseover="this.style.backgroundColor=\'' . get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) . '\'" style="border-right: 1px solid ' . get_option( 'relpoststh_bordercolor', $this->border_color ) . '; border-bottom: medium none; margin: 0pt; padding: 6px; display: block; float: left; text-decoration: none; text-align: left; cursor: pointer;" href="' . get_permalink( $post->ID ) . '">';
175
- $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; width: ' . $width . 'px; height: ' . ( $height + 75 ) . 'px;">';
176
  $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; background: transparent url(' . $url . ') no-repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: ' . $width . 'px; height: ' . $height . 'px;"></div>';
177
- $output .= '<div style="border: 0pt none; margin: 3px 0pt 0pt; padding: 0pt; font-family: ' . get_option( 'relpoststh_fontfamily', $this->font_family ) . '; font-style: normal; font-variant: normal; font-weight: normal; font-size: ' . get_option( 'relpoststh_fontsize', $this->font_size ) . 'px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; color: ' . get_option( 'relpoststh_fontcolor', $this->font_color ) . ';">' . $title . '</div>';
178
  $output .= '</div>';
179
  $output .= '</a>';
180
 
@@ -183,6 +199,13 @@ class RelatedPostsThumbnails {
183
  return $output;
184
  }
185
 
 
 
 
 
 
 
 
186
  function is_relpoststh_show() { // Checking display options
187
  if ( ! is_single() && get_option( 'relpoststh_single_only', $this->single_only ) ) { // single only
188
  return false;
@@ -216,6 +239,7 @@ class RelatedPostsThumbnails {
216
  }
217
  check_admin_referer( 'related-posts-thumbnails' );
218
  update_option( 'relpoststh_single_only', $_POST['relpoststh_single_only'] );
 
219
  update_option( 'relpoststh_top_text', $_POST['relpoststh_top_text'] );
220
  update_option( 'relpoststh_number', $_POST['relpoststh_number'] );
221
  update_option( 'relpoststh_relation', $_POST['relpoststh_relation'] );
@@ -228,10 +252,12 @@ class RelatedPostsThumbnails {
228
  update_option( 'relpoststh_fontsize', $_POST['relpoststh_fontsize'] );
229
  update_option( 'relpoststh_fontfamily', $_POST['relpoststh_fontfamily'] );
230
  update_option( 'relpoststh_textlength', $_POST['relpoststh_textlength'] );
 
231
  update_option( 'relpoststh_thsource', $_POST['relpoststh_thsource'] );
232
  update_option( 'relpoststh_customfield', $_POST['relpoststh_customfield'] );
233
  update_option( 'relpoststh_customwidth', $_POST['relpoststh_customwidth'] );
234
  update_option( 'relpoststh_customheight', $_POST['relpoststh_customheight'] );
 
235
  update_option( 'relpoststh_categoriesall', $_POST['relpoststh_categoriesall'] );
236
  update_option( 'relpoststh_categories', serialize( $_POST['relpoststh_categories'] ) );
237
  echo "<div class='updated fade'><p>" . __( 'Settings updated', 'related-posts-thumbnails' ) ."</p></div>";
@@ -244,6 +270,7 @@ class RelatedPostsThumbnails {
244
  }
245
  }
246
  $relpoststh_single_only = get_option( 'relpoststh_single_only', $this->single_only );
 
247
  $relpoststh_relation = get_option( 'relpoststh_relation', $this->relation );
248
  $relpoststh_thsource = get_option( 'relpoststh_thsource', $this->thsource );
249
  $relpoststh_categoriesall = get_option( 'relpoststh_categoriesall', $this->categories_all );
@@ -261,6 +288,13 @@ class RelatedPostsThumbnails {
261
  <div class="postbox">
262
  <h3><?php _e( 'General Display Options', 'related-posts-thumbnails' ); ?>:</h3>
263
  <table class="form-table">
 
 
 
 
 
 
 
264
  <tr valign="top">
265
  <th scope="row"><?php _e( 'Page type', 'related-posts-thumbnails' ); ?>:</th>
266
  <td>
@@ -416,6 +450,20 @@ class RelatedPostsThumbnails {
416
  <th scope="row"><?php _e( 'Text maximum length', 'related-posts-thumbnails' ); ?>:</th>
417
  <td>
418
  <input type="text" name="relpoststh_textlength" value="<?php echo get_option( 'relpoststh_textlength', $this->text_length )?>" size="7"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  </td>
420
  </tr>
421
  </table>
@@ -451,4 +499,47 @@ function related_posts_thumbnails() {
451
  global $related_posts_thumbnails;
452
  $related_posts_thumbnails = new RelatedPostsThumbnails();
453
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  ?>
2
  Plugin Name: Related Posts Thumbnails
3
  Plugin URI: http://wordpress.shaldybina.com/plugins/related-posts-thumbnails/
4
  Description: Showing related posts thumbnails under the post.
5
+ Version: 1.2
6
  Author: Maria Shaldybina
7
  Author URI: http://shaldybina.com/
8
  */
22
 
23
  /* Default values */
24
  public $single_only = '1';
25
+ public $auto = '1';
26
  public $top_text = '<h3>Related posts:</h3>';
27
  public $number = 3;
28
  public $relation = 'categories';
35
  public $font_family = 'Arial';
36
  public $font_size = '12';
37
  public $text_length = '100';
38
+ public $excerpt_length = '0';
39
  public $custom_field = '';
40
  public $custom_height = '100';
41
  public $custom_width = '100';
42
+ public $text_block_height = '75';
43
  public $thsource = 'post-thumbnails';
44
  public $categories_all = '1';
45
 
46
  function RelatedPostsThumbnails() { // initialization
47
  load_plugin_textdomain( 'related-posts-thumbnails', false, basename( dirname( __FILE__ ) ) . '/locale' );
48
  $this->default_image = WP_PLUGIN_URL . '/related-posts-thumbnails/img/default.png';
49
+ if ( get_option( 'relpoststh_auto', $this->auto ) )
50
+ add_filter( 'the_content', array( $this, 'auto_show' ) );
51
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
52
+ add_shortcode( 'related-posts-thumbnails' , array( $this, 'get_html' ) );
53
  }
54
 
55
+ function auto_show( $content ) { // Automatically displaying related posts under post body
56
+ return $content . $this->get_html();
57
+ }
58
+
59
+ function get_html() { // Getting related posts HTML
60
+ if ( $this->is_relpoststh_show() )
61
+ return stripslashes( get_option( 'relpoststh_top_text', $this->top_text ) ) . $this->get_thumbnails();
62
+ return '';
63
  }
64
 
65
+ function get_thumbnails() { // Retrieve Related Posts HTML for output
66
  $id = get_the_ID();
67
  $relation = get_option( 'relpoststh_relation', $this->relation );
68
  $posts_number = get_option( 'relpoststh_number', $this->number );
71
  }
72
  $poststhname = get_option( 'relpoststh_poststhname', $this->poststhname );
73
  $text_length = get_option( 'relpoststh_textlength', $this->text_length );
74
+ $excerpt_length = get_option( 'relpoststh_excerptlength', $this->excerpt_length );
75
  $thsource = get_option( 'relpoststh_thsource', $this->thsource );
76
  $categories_all = get_option( 'relpoststh_categoriesall', $this->categories_all );
77
  $posts = array();
136
  // displaying square if one size is not cropping
137
  if ( $height == 9999 )
138
  $height = $width;
139
+ if ( $width == 9999 )
140
  $width = $height;
141
  // theme is not supporting but settings were not changed
142
+ if ( empty( $width ) )
143
  $width = get_option( "thumbnail_size_w" );
144
  if ( empty( $height ) )
145
  $height = get_option( "thumbnail_size_h" );
178
  if ( empty( $url ) || false === @fopen( $url, 'r' ) ) { // using default image if no image was found or no such file on server
179
  $url = get_option( 'relpoststh_default_image', $this->default_image );
180
  }
181
+
182
+ $title = $this->process_text_cut( $post->post_title, $text_length );
183
+ $excerpt = $this->process_text_cut( $post->post_excerpt, $excerpt_length );
184
+
185
+ if ( !empty($title) && !empty($excerpt) ) {
186
+ $title = '<b>' . $title . '</b>';
187
+ $excerpt = '<br/>' . $excerpt;
188
+ }
189
+
190
  $output .= '<a onmouseout="this.style.backgroundColor=\'' . get_option( 'relpoststh_background', $this->background ) . '\'" onmouseover="this.style.backgroundColor=\'' . get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) . '\'" style="border-right: 1px solid ' . get_option( 'relpoststh_bordercolor', $this->border_color ) . '; border-bottom: medium none; margin: 0pt; padding: 6px; display: block; float: left; text-decoration: none; text-align: left; cursor: pointer;" href="' . get_permalink( $post->ID ) . '">';
191
+ $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; width: ' . $width . 'px; height: ' . ( $height + get_option( 'relpoststh_textblockheight', $this->text_block_height ) ) . 'px;">';
192
  $output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; background: transparent url(' . $url . ') no-repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: ' . $width . 'px; height: ' . $height . 'px;"></div>';
193
+ $output .= '<div style="border: 0pt none; margin: 3px 0pt 0pt; padding: 0pt; font-family: ' . get_option( 'relpoststh_fontfamily', $this->font_family ) . '; font-style: normal; font-variant: normal; font-weight: normal; font-size: ' . get_option( 'relpoststh_fontsize', $this->font_size ) . 'px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; color: ' . get_option( 'relpoststh_fontcolor', $this->font_color ) . ';">' . $title . $excerpt . '</div>';
194
  $output .= '</div>';
195
  $output .= '</a>';
196
 
199
  return $output;
200
  }
201
 
202
+ function process_text_cut( $text, $length ) {
203
+ if ($length == 0)
204
+ return '';
205
+ else
206
+ return ( ( strlen( $text ) > $length ) ? substr( $text, 0, $length) . '...' : $text );
207
+ }
208
+
209
  function is_relpoststh_show() { // Checking display options
210
  if ( ! is_single() && get_option( 'relpoststh_single_only', $this->single_only ) ) { // single only
211
  return false;
239
  }
240
  check_admin_referer( 'related-posts-thumbnails' );
241
  update_option( 'relpoststh_single_only', $_POST['relpoststh_single_only'] );
242
+ update_option( 'relpoststh_auto', $_POST['relpoststh_auto'] );
243
  update_option( 'relpoststh_top_text', $_POST['relpoststh_top_text'] );
244
  update_option( 'relpoststh_number', $_POST['relpoststh_number'] );
245
  update_option( 'relpoststh_relation', $_POST['relpoststh_relation'] );
252
  update_option( 'relpoststh_fontsize', $_POST['relpoststh_fontsize'] );
253
  update_option( 'relpoststh_fontfamily', $_POST['relpoststh_fontfamily'] );
254
  update_option( 'relpoststh_textlength', $_POST['relpoststh_textlength'] );
255
+ update_option( 'relpoststh_excerptlength', $_POST['relpoststh_excerptlength'] );
256
  update_option( 'relpoststh_thsource', $_POST['relpoststh_thsource'] );
257
  update_option( 'relpoststh_customfield', $_POST['relpoststh_customfield'] );
258
  update_option( 'relpoststh_customwidth', $_POST['relpoststh_customwidth'] );
259
  update_option( 'relpoststh_customheight', $_POST['relpoststh_customheight'] );
260
+ update_option( 'relpoststh_textblockheight', $_POST['relpoststh_textblockheight'] );
261
  update_option( 'relpoststh_categoriesall', $_POST['relpoststh_categoriesall'] );
262
  update_option( 'relpoststh_categories', serialize( $_POST['relpoststh_categories'] ) );
263
  echo "<div class='updated fade'><p>" . __( 'Settings updated', 'related-posts-thumbnails' ) ."</p></div>";
270
  }
271
  }
272
  $relpoststh_single_only = get_option( 'relpoststh_single_only', $this->single_only );
273
+ $relpoststh_auto = get_option( 'relpoststh_auto', $this->auto );
274
  $relpoststh_relation = get_option( 'relpoststh_relation', $this->relation );
275
  $relpoststh_thsource = get_option( 'relpoststh_thsource', $this->thsource );
276
  $relpoststh_categoriesall = get_option( 'relpoststh_categoriesall', $this->categories_all );
288
  <div class="postbox">
289
  <h3><?php _e( 'General Display Options', 'related-posts-thumbnails' ); ?>:</h3>
290
  <table class="form-table">
291
+ <tr valign="top">
292
+ <th scope="row"><?php _e( 'Automatically append to the post content', 'related-posts-thumbnails' ); ?>:</th>
293
+ <td>
294
+ <input type="checkbox" name="relpoststh_auto" id="relpoststh_auto" value="1" <?php if ( $relpoststh_auto ) echo 'checked="checked"'; ?>/>
295
+ <label for="relpoststh_auto"><?php _e( 'Or use <b>&lt;?php get_related_posts_thumbnails(); ?&gt;</b> in the Loop', 'related-posts-thumbnails' ); ?></label><br />
296
+ </td>
297
+ </tr>
298
  <tr valign="top">
299
  <th scope="row"><?php _e( 'Page type', 'related-posts-thumbnails' ); ?>:</th>
300
  <td>
450
  <th scope="row"><?php _e( 'Text maximum length', 'related-posts-thumbnails' ); ?>:</th>
451
  <td>
452
  <input type="text" name="relpoststh_textlength" value="<?php echo get_option( 'relpoststh_textlength', $this->text_length )?>" size="7"/>
453
+ <label for="relpoststh_textlength"><?php _e( 'Set 0 for no title', 'related-posts-thumbnails' ); ?></label><br />
454
+ </td>
455
+ </tr>
456
+ <tr valign="top">
457
+ <th scope="row"><?php _e( 'Excerpt maximum length', 'related-posts-thumbnails' ); ?>:</th>
458
+ <td>
459
+ <input type="text" name="relpoststh_excerptlength" value="<?php echo get_option( 'relpoststh_excerptlength', $this->excerpt_length )?>" size="7"/>
460
+ <label for="relpoststh_excerptlength"><?php _e( 'Set 0 for no excerpt', 'related-posts-thumbnails' ); ?></label><br />
461
+ </td>
462
+ </tr>
463
+ <tr valign="top">
464
+ <th scope="row"><?php _e( 'Text block height', 'related-posts-thumbnails' ); ?>:</th>
465
+ <td>
466
+ <input type="text" name="relpoststh_textblockheight" value="<?php echo get_option( 'relpoststh_textblockheight', $this->text_block_height )?>" size="7"/> px
467
  </td>
468
  </tr>
469
  </table>
499
  global $related_posts_thumbnails;
500
  $related_posts_thumbnails = new RelatedPostsThumbnails();
501
  }
502
+
503
+ function get_related_posts_thumbnails()
504
+ {
505
+ global $related_posts_thumbnails;
506
+ echo $related_posts_thumbnails->get_html();
507
+ }
508
+
509
+ /**
510
+ * Related Posts Widget, will be displayed on post page
511
+ */
512
+ class RelatedPostsThumbnailsWidget extends WP_Widget {
513
+ function RelatedPostsThumbnailsWidget() {
514
+ parent::WP_Widget(false, $name = 'Related Posts Thumbnails');
515
+ }
516
+
517
+ function widget($args, $instance) {
518
+ if ( is_single() && !is_page() ) { // display on post page only
519
+ extract( $args );
520
+ $title = apply_filters('widget_title', $instance['title']);
521
+ echo $before_widget;
522
+ if ( $title )
523
+ echo $before_title . $title . $after_title;
524
+ get_related_posts_thumbnails();
525
+ echo $after_widget;
526
+ }
527
+ }
528
+
529
+ function update($new_instance, $old_instance) {
530
+ $instance = $old_instance;
531
+ $instance['title'] = strip_tags($new_instance['title']);
532
+ return $instance;
533
+ }
534
+
535
+ function form($instance) {
536
+ $title = esc_attr($instance['title']);
537
+ ?>
538
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
539
+ <?php
540
+ }
541
+
542
+ } // class RelatedPostsThumbnailsWidget
543
+
544
+ add_action( 'widgets_init', create_function( '', 'return register_widget("RelatedPostsThumbnailsWidget");' ) );
545
  ?>
screenshot-1.png CHANGED
Binary file