You appear to be a bot. Output may be restricted
Description
Implement "oik_shortcode_content" to pre-paginate the shortcode contentWe should have already worked out the pagination with the following values set. [posts_per_page] => 3 [bwscid] => 1 [paged] => 1 To make the pagination logic work we need to fiddle bw_query to look like we've actually done some SQL. We also need to indicate to the front-end that the pagination is content based.
Usage
$string = oika_oik_shortcode_content( $content, $atts, $tag );
Parameters
- $content
- ( string ) required – content to be paginated
- $atts
- ( array ) required – shortcode attributes
- $tag
- ( string ) required – the shortcode
Returns
string that part of the content to be processedTO DO
find a way to cater for start and end tags. e.g. for lists or tablesSource
File name: oik-ajax/oik-ajax.phpLines:
1 to 22 of 22
function oika_oik_shortcode_content( $content, $atts, $tag ) { if ( $content ) { $content = trim( $content ); $content_array = explode( "\n", $content ); $start = 0; $posts_per_page = bw_array_get( $atts, "posts_per_page", null ); if ( $posts_per_page ) { $page = bw_array_get( $atts, "paged", 1 ); if ( $page > 1 ) { $start = ( $page-1 ) * $posts_per_page; } //$end = $start + $posts_per_page; $count = count( $content_array ); bw_trace2( $content_array, "content_array" ); //$end = min( $start + $posts_per_page, $count ) -1 ; $content_array = array_slice( $content_array, $start, $posts_per_page ); $content = implode( "\n", $content_array ); } } return( $content ); }View on GitHub