Skip to content

Commit faefe3d

Browse files
committed
After Loop Filter
1 parent 4a1fc0f commit faefe3d

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

tootpress_blog.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,25 @@ function tootpress_paint_beforeloop($tootpress_current_page) {
230230

231231
}
232232

233+
/**
234+
* Create the After Loop Content.
235+
*
236+
* @since 0.5
237+
*
238+
* @param int TootPress Current Page
239+
* @return string Content
240+
*/
241+
242+
function tootpress_paint_afterloop($tootpress_current_page) {
243+
244+
$content=tootpress_afterloop_filter_apply($tootpress_current_page);
245+
246+
if($content) {
247+
$content='<div class="tootpress-afterloop">'.$content.'</div>';
248+
}
249+
250+
return $content;
251+
252+
}
253+
233254
?>

tootpress_hooks.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function tootpress_menu_backward_filter_apply($label) {
103103
*
104104
* @since 0.5
105105
*
106-
* @param int TootPress Page Number
106+
* @param int TootPress Current Page Number
107107
* @return string Content
108108
*/
109109

@@ -117,4 +117,26 @@ function tootpress_beforeloop_filter_apply($current_page_number) {
117117
return $content;
118118
}
119119

120+
/**
121+
* After Loop Filter
122+
*
123+
* This filter outputs content after the toot loop.
124+
* It will be applied on all tootpress pages.
125+
*
126+
* @since 0.5
127+
*
128+
* @param int TootPress Current Page Number
129+
* @return string Content
130+
*/
131+
132+
function tootpress_afterloop_filter_apply($current_page_number) {
133+
134+
$content='';
135+
$last_page_number=tootpress_amount_of_pages();
136+
137+
$content=apply_filters( 'tootpress_afterloop_filter', $content, $current_page_number, $last_page_number );
138+
139+
return $content;
140+
}
141+
120142
?>

tootpress_loop.php

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

44+
// TootPress After Loop
45+
$tootpress_content.=tootpress_paint_afterloop($tootpress_current_page);
46+
4447
// TootPress Closing
4548
$tootpress_content.=tootpress_paint_closing($tootpress_current_page);
4649

0 commit comments

Comments
 (0)