Skip to content

Commit cd5374b

Browse files
committed
Forward Filter
1 parent e6c65df commit cd5374b

File tree

4 files changed

+74
-4
lines changed

4 files changed

+74
-4
lines changed

readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,21 @@ You can use the following code.
145145
}
146146
add_filter( 'tootpress_closing_filter', 'tootpress_closing_add', 10, 1 );
147147

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+
148163
## WordPress Framework
149164

150165
Following components of WordPress are used in TootPress.
@@ -226,6 +241,7 @@ This project is licensed under the GPL3 License.
226241

227242
* xxx
228243
* Feature: Closing Filter
244+
* Feature: Move Forward Label Filter
229245

230246
### 0.4 "Cassie Lang"
231247

readme.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,20 @@ You can use the following code.
144144
`}`
145145
`add_filter( 'tootpress_closing_filter', 'tootpress_closing_add', 10, 1 );`
146146

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+
147161
= Related Links =
148162

149163
* [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
@@ -117,4 +117,38 @@ function tootpress_closing_filter_apply($content) {
117117
*
118118
*/
119119

120+
/**
121+
* Move Forward Filter
122+
*
123+
* This filter overwrites the forward label in the menu
124+
*
125+
* @since 0.5
126+
*
127+
* @param string Label Forward
128+
* @return string New Label
129+
*/
130+
131+
function tootpress_menu_forward_filter_apply($label) {
132+
$label=apply_filters( 'tootpress_menu_forward_label', $label );
133+
return $label;
134+
}
135+
136+
/**
137+
* Usage Example: tootpress_menu_forward_label
138+
*
139+
* @param string Label Forward
140+
* @return string New Label
141+
*
142+
* function tootpress_menu_forward_label_change( $label ) {
143+
*
144+
* // Add your filter code here
145+
* // Example: $label='Newer Posts';
146+
*
147+
* return $label;
148+
*
149+
* }
150+
* add_filter( 'tootpress_menu_forward_label', 'tootpress_menu_forward_label_change', 10, 1 );
151+
*
152+
*/
153+
120154
?>

tootpress_menu.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,21 +276,27 @@ function tootpress_label_older_toots() {
276276
}
277277

278278
/**
279-
* Creates Newer Toots Label
279+
* Create Newer Toots Label
280280
*
281281
* @since 0.1
282282
*
283283
* @return string Label
284284
*/
285285

286-
function tootpress_label_newer_toots() {
286+
function tootpress_label_newer_toots() {
287+
288+
$label='';
287289

288290
if(tootpress_is_language_german()) {
289-
return 'Neuere Toots';
291+
$label='Neuere Toots';
290292
} else {
291-
return 'Newer Toots';
293+
$label='Newer Toots';
292294
}
293295

296+
// Apply Filter
297+
$label=tootpress_menu_forward_filter_apply($label);
298+
299+
return $label;
294300
}
295301

296302
?>

0 commit comments

Comments
 (0)