WordPress.org

Make WordPress Core

Ticket #9911: paginator.php

File paginator.php, 1.3 KB (added by sirzooro, 6 years ago)

example plugin

Line 
1<?php
2/*
3Plugin Name: Paginator
4Description: This plugin paginates posts
5Author: Daniel Frużyński
6Version: 1.0
7Author URI: http://www.poradnik-webmastera.com/
8*/
9
10/*  Copyright 2009  Daniel Frużyński  (email : daniel [A-T] poradnik-webmastera.com)
11
12    This program is free software; you can redistribute it and/or modify
13    it under the terms of the GNU General Public License as published by
14    the Free Software Foundation; either version 2 of the License, or
15    (at your option) any later version.
16
17    This program is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20    GNU General Public License for more details.
21
22    You should have received a copy of the GNU General Public License
23    along with this program; if not, write to the Free Software
24    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25*/
26
27
28add_filter( 'content_paginate', 'test_content_paginate' );
29               
30function test_content_paginate( $content ) {
31        $ret = array();
32        foreach ( $content as $txt ) {
33                $txt2 = explode( "\n", $txt );
34                foreach ( $txt2 as $txt3 ) {
35                        $txt3 = trim( $txt3 );
36                        if ( $txt3 != '' ) {
37                                $ret[] = $txt3;
38                        }
39                }
40        }
41        return $ret;
42}
43
44?>