Skip to content

Commit f5dd42f

Browse files
authored
Merge pull request #28 from circuscode/feature-filter
A lot of Filters
2 parents d5d0231 + d41c45e commit f5dd42f

File tree

8 files changed

+528
-62
lines changed

8 files changed

+528
-62
lines changed

readme.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ You can use the following code.
115115

116116
### Filter
117117

118-
#### tootpress_preamble_add
118+
#### tootpress_preamble_filter
119119

120-
This filter outputs html content before the toot loop.
120+
This filter outputs html content before the initial toot loop.
121121
You can use the following code.
122122

123123
function tootpress_preamble_add( $preamble ) {
@@ -130,6 +130,66 @@ You can use the following code.
130130
}
131131
add_filter( 'tootpress_preamble_filter', 'tootpress_preamble_add', 10, 1 );
132132

133+
#### tootpress_closing_filter
134+
135+
This filter outputs html content after the last toot loop.
136+
You can use the following code.
137+
138+
function tootpress_closing_add( $content ) {
139+
140+
// Add your filter code here
141+
// Example: $content='<p>Hello World.</p>';
142+
143+
return $content;
144+
145+
}
146+
add_filter( 'tootpress_closing_filter', 'tootpress_closing_add', 10, 1 );
147+
148+
#### tootpress_menu_forward_label
149+
150+
This filter overwrites the forward label in the bottom navigation.
151+
You can use the following code.
152+
153+
function tootpress_menu_forward_label_change( $label ) {
154+
155+
// Add your filter code here
156+
// Example: $label='Newer Posts';
157+
158+
return $label;
159+
160+
}
161+
add_filter( 'tootpress_menu_forward_label', 'tootpress_menu_forward_label_change', 10, 1 );
162+
163+
#### tootpress_menu_backward_label
164+
165+
This filter overwrites the backward label in the bottom navigation.
166+
You can use the following code.
167+
168+
function tootpress_menu_backward_label_change( $label ) {
169+
170+
// Add your filter code here
171+
// Example: $label='Older Posts';
172+
173+
return $label;
174+
175+
}
176+
add_filter( 'tootpress_menu_backward_label', 'tootpress_menu_backward_label_change', 10, 1 );
177+
178+
#### tootpress_beforeloop_filter
179+
180+
This filter outputs content before the toot loop (on all tootpress pages).
181+
You can use the following code.
182+
183+
function tootpress_beforeloop_filter_add( $content, $page_number ) {
184+
185+
// Add your filter code here
186+
// Example: $content='<p>Page '.$page_number.'</p>';
187+
188+
return $label;
189+
190+
}
191+
add_filter( 'tootpress_beforeloop_filter', 'tootpress_beforeloop_filter_add', 10, 2 );
192+
133193
## WordPress Framework
134194

135195
Following components of WordPress are used in TootPress.
@@ -207,6 +267,19 @@ This project is licensed under the GPL3 License.
207267

208268
## Changelog
209269

270+
### 0.5 "Echo"
271+
272+
* Feature: Closing Filter
273+
* Feature: Move Forward Label Filter
274+
* Feature: Move Backward Label Filter
275+
* Feature: Before Loop Filter
276+
* Feature: After Loop Filter
277+
* Feature: Mastodon Logo Filter
278+
* Feature: Between Filter
279+
* Feature: Toot Content Filter
280+
* Feature: Date Filter
281+
* Feature: Image Filter
282+
210283
### 0.4 "Cassie Lang"
211284

212285
* June 2024

readme.txt

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ You can use the following code.
116116
`}`
117117
`add_action('tootpress_toots_update', 'tootpress_toots_update_postprocessing');`
118118

119-
**Filter: tootpress_preamble_add**
119+
**Filter: tootpress_preamble_filter**
120120
It outputs html content before the toot loop.
121121
You can use the following code.
122122

@@ -130,6 +130,62 @@ You can use the following code.
130130
`}`
131131
`add_filter( 'tootpress_preamble_filter', 'tootpress_preamble_add', 10, 1 );`
132132

133+
**Filter: tootpress_closing_filter**
134+
It outputs html content after the last toot loop.
135+
You can use the following code.
136+
137+
`function tootpress_closing_add( $content ) {`
138+
``
139+
` // Add your filter code here`
140+
` // Example: $content='<p>Hello World.</p>';`
141+
``
142+
` return $content;`
143+
``
144+
`}`
145+
`add_filter( 'tootpress_closing_filter', 'tootpress_closing_add', 10, 1 );`
146+
147+
**Filter: tootpress_menu_forward_label**
148+
This filter overwrites the forward label in the bottom navigation.
149+
You can use the following code.
150+
151+
`function tootpress_menu_forward_label_change( $label ) {`
152+
``
153+
` // Add your filter code here`
154+
` // Example: $label='Newer Posts';`
155+
``
156+
` return $label;`
157+
``
158+
`}`
159+
`add_filter( 'tootpress_menu_forward_label', 'tootpress_menu_forward_label_change', 10, 1 );`
160+
161+
**Filter: tootpress_menu_backward_label**
162+
This filter overwrites the backward label in the bottom navigation.
163+
You can use the following code.
164+
165+
`function tootpress_menu_backward_label_change( $label ) {`
166+
``
167+
` // Add your filter code here`
168+
` // Example: $label='Older Posts';`
169+
``
170+
` return $label;`
171+
``
172+
`}`
173+
`add_filter( 'tootpress_menu_backward_label', 'tootpress_menu_backward_label_change', 10, 1 );`
174+
175+
**Filter: tootpress_beforeloop_filter**
176+
This filter outputs content before the toot loop (on all tootpress pages).
177+
You can use the following code.
178+
179+
`function tootpress_beforeloop_filter_add( $content, $page_number ) {`
180+
``
181+
` // Add your filter code here`
182+
` // Example: $content='<p>Page '.$page_number.'</p>';`
183+
``
184+
` return $label;`
185+
``
186+
`}`
187+
`add_filter( 'tootpress_beforeloop_filter', 'tootpress_beforeloop_filter_add', 10, 2 );`
188+
133189
= Related Links =
134190

135191
* [Source Code @ GitHub](https://github.com/circuscode/tootpress)

tootpress.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
require_once('tootpress_developer.php');
4343
require_once('tootpress_script.php');
4444

45+
// Dev
46+
// require_once('tootpress_filter.php');
47+
4548
// Ensure that all required functions are available during setup
4649
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
4750

0 commit comments

Comments
 (0)