Skip to content

Commit c3f0ce7

Browse files
committed
Afterloop Filter
1 parent d5d0231 commit c3f0ce7

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed

readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ This project is licensed under the GPL3 License.
207207

208208
## Changelog
209209

210+
### 0.5 "xxx"
211+
212+
* xxx 2025
213+
* Feature: Afterloop Filter
214+
210215
### 0.4 "Cassie Lang"
211216

212217
* June 2024

tootpress_blog.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,32 @@ function tootpress_paint_preamble($tootpress_current_page) {
181181

182182
}
183183

184+
/**
185+
* Creates the Afterloop Content
186+
*
187+
* @since 0.5
188+
*
189+
* @param int TootPress Current Page
190+
* @return string html
191+
*/
192+
193+
function tootpress_paint_afterloop($tootpress_current_page) {
194+
195+
$content='';
196+
$lastpage=tootpress_amount_of_pages();
197+
198+
if($tootpress_current_page==$lastpage) {
199+
200+
$content.=tootpress_afterloop_filter_apply($content);
201+
202+
if($content) {
203+
$content='<div class="tootpress-afterloop">'.$content.'</div>';
204+
}
205+
206+
}
207+
208+
return $content;
209+
210+
}
211+
184212
?>

tootpress_hooks.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,40 @@ function tootpress_preamble_filter_apply($preamble) {
8181
*
8282
*/
8383

84+
/**
85+
* Afterloop Filter
86+
*
87+
* This filter outputs html content after the toot loop.
88+
*
89+
* @since 0.5
90+
*
91+
* @param string Unfiltered Content
92+
* @return html Filtered Content
93+
*/
94+
95+
function tootpress_afterloop_filter_apply($content) {
96+
$content.=apply_filters( 'tootpress_afterloop_filter', $content );
97+
return $content;
98+
}
99+
100+
/**
101+
* Filter Example: tootpress_afterloop_filter
102+
*
103+
* @since 0.5
104+
*
105+
* @param string Unfiltered Content
106+
* @return html Filtered Content
107+
*
108+
* function tootpress_afterloop_add( $content ) {
109+
*
110+
* // Add your filter code here
111+
* // Example: $content='<p>Hello World.</p>';
112+
*
113+
* return $content;
114+
*
115+
* }
116+
* add_filter( 'tootpress_afterloop_filter', 'tootpress_afterloop_add', 10, 1 );
117+
*
118+
*/
119+
84120
?>

tootpress_loop.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ function tootpress_content($content) {
3838
// TootPress Loop
3939
$tootpress_content.=tootpress_loop($tootpress_current_page);
4040

41+
// TootPress Afterloop
42+
$tootpress_content.=tootpress_paint_afterloop($tootpress_current_page);
43+
4144
// TootPress Bottom Navigation
4245
$tootpress_content.=tootpress_create_menu($tootpress_current_page);
4346

0 commit comments

Comments
 (0)