Skip to content

Commit 64e69ea

Browse files
committed
Backward Label Filter
1 parent cd5374b commit 64e69ea

File tree

4 files changed

+73
-2
lines changed

4 files changed

+73
-2
lines changed

readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,21 @@ You can use the following code.
160160
}
161161
add_filter( 'tootpress_menu_forward_label', 'tootpress_menu_forward_label_change', 10, 1 );
162162

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+
163178
## WordPress Framework
164179

165180
Following components of WordPress are used in TootPress.
@@ -242,6 +257,7 @@ This project is licensed under the GPL3 License.
242257
* xxx
243258
* Feature: Closing Filter
244259
* Feature: Move Forward Label Filter
260+
* Feature: Move Backward Label Filter
245261

246262
### 0.4 "Cassie Lang"
247263

readme.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,20 @@ You can use the following code.
158158
`}`
159159
`add_filter( 'tootpress_menu_forward_label', 'tootpress_menu_forward_label_change', 10, 1 );`
160160

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+
161175
= Related Links =
162176

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

tootpress_hooks.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,39 @@ function tootpress_menu_forward_filter_apply($label) {
150150
* add_filter( 'tootpress_menu_forward_label', 'tootpress_menu_forward_label_change', 10, 1 );
151151
*
152152
*/
153+
154+
/**
155+
* Move Backward Filter
156+
*
157+
* This filter overwrites the backward label in the menu
158+
*
159+
* @since 0.5
160+
*
161+
* @param string Label Backward
162+
* @return string New Label
163+
*/
164+
165+
function tootpress_menu_backward_filter_apply($label) {
166+
$label=apply_filters( 'tootpress_menu_backward_label', $label );
167+
return $label;
168+
}
169+
170+
/**
171+
* Usage Example: tootpress_menu_backward_label
172+
*
173+
* @param string Label Backward
174+
* @return string New Label
175+
*
176+
* function tootpress_menu_backward_label_change( $label ) {
177+
*
178+
* // Add your filter code here
179+
* // Example: $label='Older Posts';
180+
*
181+
* return $label;
182+
*
183+
* }
184+
* add_filter( 'tootpress_menu_backward_label', 'tootpress_menu_backward_label_change', 10, 1 );
185+
*
186+
*/
153187

154188
?>

tootpress_menu.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,19 @@ function tootpress_amount_of_pages() {
267267

268268
function tootpress_label_older_toots() {
269269

270+
$label='';
271+
270272
if(tootpress_is_language_german()) {
271-
return 'Ältere Toots';
273+
$label='Ältere Toots';
272274
} else {
273-
return 'Older Toots';
275+
$label='Older Toots';
274276
}
275277

278+
// Apply Filter
279+
$label=tootpress_menu_backward_filter_apply($label);
280+
281+
return $label;
282+
276283
}
277284

278285
/**

0 commit comments

Comments
 (0)