Skip to content

Commit 498cd19

Browse files
committed
Update readme
1 parent a947287 commit 498cd19

File tree

2 files changed

+274
-8
lines changed

2 files changed

+274
-8
lines changed

readme.md

Lines changed: 132 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ TootPress copies your toots from Mastodon to WordPress continuously. The toots c
1616

1717
## Installation
1818

19-
1. Download the plugin from the GitHub Repository (see latest Release)
19+
1. Download the plugin from the GitHub Repository (latest Release)
2020
2. Rename the downloaded folder to "tootpress"
2121
2. Upload the folder to the WordPress Plugin Directory
2222
3. Activate the plugin in WordPress
@@ -66,8 +66,8 @@ Following toot objects are not supported.
6666
* Audio
6767
* Video
6868
* Poll
69-
* Emojis
7069
* Teaser
70+
* Quotes
7171

7272
## Excluded Toot Types
7373

@@ -180,15 +180,125 @@ You can use the following code.
180180
This filter outputs content before the toot loop (on all tootpress pages).
181181
You can use the following code.
182182

183-
function tootpress_beforeloop_filter_add( $content, $page_number ) {
183+
function tootpress_beforeloop_add( $content, $current_page_number, $last_page_number ) {
184+
185+
// Add your filter code here
186+
// Example: $content='<p>Page '.$current_page_number.' of '.$last_page_number.'</p>';
187+
188+
return $content;
189+
190+
}
191+
add_filter( 'tootpress_beforeloop_filter', 'tootpress_beforeloop_add', 10, 3 );
192+
193+
#### tootpress_afterloop_filter
194+
195+
This filter outputs content after the toot loop (on all tootpress pages).
196+
You can use the following code.
197+
198+
function tootpress_afterloop_add( $content, $current_page_number, $last_page_number ) {
199+
200+
// Add your filter code here
201+
// Example: $content='<p>Page '.$current_page_number.' of '.$last_page_number.'</p>';
202+
203+
return $content;
204+
205+
}
206+
add_filter( 'tootpress_afterloop_filter', 'tootpress_afterloop_add', 10, 3 );
207+
208+
#### tootpress_mastodon_logo_filter
209+
210+
This filter overwrites the Mastodon Logo with Custom Logo.
211+
You can use the following code.
212+
213+
function tootpress_mastodon_logo_change ( $img ) {
214+
215+
// Standard Value
216+
// <img class="toot-symbol" src="FILE-URL" alt="Toot Symbol" width="35" height="37"/>
217+
218+
// Add your filter code here
219+
// Example: $img='<img class="toot-symbol" src="FILE-URL" alt="Custom Toot Symbol" width="32" height="32"/>';
220+
221+
return $img;
222+
223+
}
224+
add_filter( 'tootpress_mastodon_logo_filter', 'tootpress_mastodon_logo_change', 10, 1 );
225+
226+
#### tootpress_between_filter
227+
228+
This filter adds custom HTML between the toots.
229+
You can use the following code.
230+
231+
function tootpress_create_element_between ( $content ) {
232+
233+
// Add your filter code here
234+
// $content='<hr/>';
235+
236+
return $content;
237+
238+
}
239+
add_filter( 'tootpress_between_filter', 'tootpress_create_element_between', 10, 1 );
240+
241+
#### tootpress_toot_content_filter
242+
243+
This filter can be used to manipulate the toot content.
244+
You can use the following code.
245+
246+
function tootpress_manipulate_content ( $content ) {
247+
248+
// Add your filter code here
249+
// $content=str_replace('href=','target="_blank" href=',$content);
184250

251+
return $content;
252+
253+
}
254+
add_filter( 'tootpress_toot_content_filter', 'tootpress_manipulate_content', 10, 1 );
255+
256+
#### tootpress_date_filter
257+
258+
This filter overwrites the date output with custom format.
259+
You can use the following code.
260+
261+
function tootpress_date_custom_format ( $date, $year, $month, $day, $hour, $minute, $second ) {
262+
263+
// $date = 2023-05-30 22:40:28
264+
// $year = 2023
265+
// $month = 05
266+
// $day = 30
267+
// $hour = 22
268+
// $minute = 40
269+
// $second = 28
270+
185271
// Add your filter code here
186-
// Example: $content='<p>Page '.$page_number.'</p>';
272+
// $date=$day.'.'.$month.'.'.$year.' '.$hour.':'.$minute.':'.$second;
273+
274+
return $date;
187275

188-
return $label;
276+
}
277+
add_filter( 'tootpress_date_filter', 'tootpress_date_custom_format', 10, 7 );
278+
279+
#### tootpress_image_filter
280+
281+
This filter can be used to manipulate image tags.
282+
You can use the following code.
283+
284+
function tootpress_image_manipulate ($img_tag,$filename,$description,$width,$height,$image_directory_path,$amount_of_images,$image_number) {
285+
286+
// Amount of Images
287+
// ----------------
288+
// 1 = Single Image
289+
// >1 = Gallery + Size of Gallery
290+
291+
// Image Number
292+
// ------------
293+
// This number indicates position within the gallery
294+
295+
// Add your filter code here
296+
// $img_tag=str_replace('alt=','class="tootpress-image" alt=',$img_tag);
297+
298+
return $img_tag;
189299

190300
}
191-
add_filter( 'tootpress_beforeloop_filter', 'tootpress_beforeloop_filter_add', 10, 2 );
301+
add_filter( 'tootpress_image_filter', 'tootpress_image_manipulate', 1, 8 );
192302

193303
## WordPress Framework
194304

@@ -229,6 +339,22 @@ Backlinks to Mastodon can be activated in the plugin settings. In this case, the
229339

230340
No. TootPress does not support the WordPress Multisite Feature. The plugin is working on the master-site, but is not working on all other child sites within the wordpress network.
231341

342+
### Are the toots included in the WordPress Search?
343+
344+
Unfortunately not.
345+
346+
### Is there any possiblity to modify the outputs on the user interface?
347+
348+
Almost every content element, which is created by TootPress in the FrontEnd, can be modified. For example, you can replace the Mastodon Logo with another image. Enabeling this, the plugin is providing a bunch of filters. Please read the documentation of the filter above.
349+
350+
### Does TootPress recognize, if a published Toot was edited on Mastodon?
351+
352+
The plugin does not sync the Toots between Mastodon and WordPress. TootPress is copying the toots just once after they are published on Mastodon. So if a published toot is edited on Mastodon later, TootPress does not recognized this change anymore, if the toot was already copied to WordPress. Reflecting the edit in WordPress there is only the possibility to make the same edit again directly in the WordPress database. The toots are stored in the table tootpress_toots.
353+
354+
### Can toots be loaded from several Mastodon instances?
355+
356+
No. The plugin does currently not support several Mastodon instances. The architecture is designed to load toots from one single instance. Independent from this, if your toot history is spread over several instances and the timelines does not overlap, you can try to load the timelines one after another. This is not officially supported or tested, but based on user feedback this seems to work surprisingly.
357+
232358
## Maturity Grade
233359

234360
* Low maturity level

readme.txt

Lines changed: 142 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: unmus
33
Tags: mastodon, toots, microblogging, blog, fediverse
44
Requires at least: 6.1
55
Tested up to: 6.8
6-
Stable tag: 0.4
6+
Stable tag: 0.5
77
License: GNU General Public License v3 or later
88
License URI: https://www.gnu.org/licenses/gpl-3.0.html
99

@@ -72,8 +72,8 @@ Following toot objects are not supported.
7272
* Audio
7373
* Video
7474
* Poll
75-
* Emojis
7675
* Teaser
76+
* Quotes
7777

7878
= Excluded Toot Types =
7979

@@ -186,6 +186,110 @@ You can use the following code.
186186
`}`
187187
`add_filter( 'tootpress_beforeloop_filter', 'tootpress_beforeloop_filter_add', 10, 2 );`
188188

189+
**Filter: tootpress_afterloop_filter**
190+
This filter outputs content after the toot loop (on all tootpress pages).
191+
You can use the following code.
192+
193+
`function tootpress_afterloop_add( $content, $current_page_number, $last_page_number ) {`
194+
``
195+
` // Add your filter code here`
196+
` // Example: $content='<p>Page '.$current_page_number.' of '.$last_page_number.'</p>';`
197+
``
198+
` return $content;`
199+
``
200+
`}`
201+
`add_filter( 'tootpress_afterloop_filter', 'tootpress_afterloop_add', 10, 3 );`
202+
203+
**Filter: tootpress_mastodon_logo_filter**
204+
This filter overwrites the Mastodon Logo with Custom Logo.
205+
You can use the following code.
206+
207+
`function tootpress_mastodon_logo_change ( $img ) {`
208+
``
209+
` // Standard Value`
210+
` // <img class="toot-symbol" src="FILE-URL" alt="Toot Symbol" width="35" height="37"/>`
211+
``
212+
` // Add your filter code here`
213+
` // Example: $img='<img class="toot-symbol" src="FILE-URL" alt="Custom Toot Symbol" width="32" height="32"/>';`
214+
``
215+
` return $img;`
216+
``
217+
`}`
218+
`add_filter( 'tootpress_mastodon_logo_filter', 'tootpress_mastodon_logo_change', 10, 1 );`
219+
220+
**Filter: tootpress_between_filter**
221+
This filter adds custom HTML between the toots.
222+
You can use the following code.
223+
224+
`function tootpress_create_element_between ( $content ) {`
225+
``
226+
` // Add your filter code here`
227+
` // $content='<hr/>';`
228+
``
229+
` return $content;`
230+
``
231+
`}
232+
`add_filter( 'tootpress_between_filter', 'tootpress_create_element_between', 10, 1 );`
233+
234+
**Filter: tootpress_toot_content_filter**
235+
This filter can be used to manipulate the toot content.
236+
You can use the following code.
237+
238+
`function tootpress_manipulate_content ( $content ) {`
239+
``
240+
` // Add your filter code here`
241+
` // $content=str_replace('href=','target="_blank" href=',$content); `
242+
``
243+
` return $content;`
244+
``
245+
`}
246+
`add_filter( 'tootpress_toot_content_filter', 'tootpress_manipulate_content', 10, 1 );`
247+
248+
**Filter: tootpress_date_filter**
249+
This filter overwrites the date output with custom format.
250+
You can use the following code.
251+
252+
`function tootpress_date_custom_format ( $date, $year, $month, $day, $hour, $minute, $second ) {`
253+
``
254+
` // $date = 2023-05-30 22:40:28`
255+
` // $year = 2023`
256+
` // $month = 05`
257+
` // $day = 30`
258+
` // $hour = 22`
259+
` // $minute = 40`
260+
` // $second = 28`
261+
``
262+
` // Add your filter code here`
263+
` // $date=$day.'.'.$month.'.'.$year.' '.$hour.':'.$minute.':'.$second;`
264+
``
265+
` return $date;`
266+
``
267+
`}
268+
`add_filter( 'tootpress_date_filter', 'tootpress_date_custom_format', 10, 7 );`
269+
270+
**Filter: tootpress_image_filter**
271+
This filter can be used to manipulate image tags.
272+
You can use the following code.
273+
274+
`function tootpress_image_manipulate ($img_tag,$filename,$description,$width,$height,$image_directory_path,$amount_of_images,$image_number) {`
275+
``
276+
` // Amount of Images`
277+
` // ----------------`
278+
` // 1 = Single Image`
279+
` // >1 = Gallery + Size of Gallery`
280+
``
281+
` // Image Number`
282+
` // ------------`
283+
` // This number indicates position within the gallery`
284+
``
285+
` // Add your filter code here`
286+
` // $img_tag=str_replace('alt=','class="tootpress-image" alt=',$img_tag);`
287+
``
288+
` return $img_tag;`
289+
``
290+
`}
291+
`add_filter( 'tootpress_image_filter', 'tootpress_image_manipulate', 1, 8 );`
292+
189293
= Related Links =
190294

191295
* [Source Code @ GitHub](https://github.com/circuscode/tootpress)
@@ -219,8 +323,41 @@ Backlinks to Mastodon can be activated in the plugin settings. In this case, the
219323

220324
No. TootPress does not support the WordPress Multisite Feature. The plugin is working on the master-site, but is not working on all other child sites within the wordpress network.
221325

326+
= Are the toots included in the WordPress Search? =
327+
328+
Unfortunately not.
329+
330+
= Is there any possiblity to modify the outputs on the user interface? =
331+
332+
Almost every content element, which is created by TootPress in the FrontEnd, can be modified. For example, you can replace the Mastodon Logo with another image. Enabeling this, the plugin is providing a bunch of filters. Please read the documentation of the filter above.
333+
334+
= Does TootPress recognize, if a published Toot was edited on Mastodon? =
335+
336+
The plugin does not sync the Toots between Mastodon and WordPress. TootPress is copying the toots just once after they are published on Mastodon. So if a published toot is edited on Mastodon later, TootPress does not recognized this change anymore, if the toot was already copied to WordPress. Reflecting the edit in WordPress there is only the possibility to make the same edit again directly in the WordPress database. The toots are stored in the table tootpress_toots.
337+
338+
= Can toots be loaded from several Mastodon instances? =
339+
340+
No. The plugin does currently not support several Mastodon instances. The architecture is designed to load toots from one single instance. Independent from this, if your toot history is spread over several instances and the timelines does not overlap, you can try to load the timelines one after another. This is not officially supported or tested, but based on user feedback this seems to work surprisingly.
341+
222342
== Changelog ==
223343

344+
= 0.5 "Echo" =
345+
346+
* July 2025
347+
* Feature: Closing Filter
348+
* Feature: Move Forward Label Filter
349+
* Feature: Move Backward Label Filter
350+
* Feature: Before Loop Filter
351+
* Feature: After Loop Filter
352+
* Feature: Mastodon Logo Filter
353+
* Feature: Between Filter
354+
* Feature: Toot Content Filter
355+
* Feature: Date Filter
356+
* Feature: Image Filter
357+
* Changed: DOM Structure
358+
* Renamed: CSS Classes
359+
* Security: Better Output Escaping
360+
224361
= 0.4 "Cassie Lang" =
225362

226363
* June 2024
@@ -256,6 +393,9 @@ No. TootPress does not support the WordPress Multisite Feature. The plugin is wo
256393

257394
== Upgrade Notice ==
258395

396+
= 0.5 =
397+
This version brings a bunch of filters enabling customization.
398+
259399
= 0.4 =
260400
This version includes a preamble filter.
261401

0 commit comments

Comments
 (0)