PHP code example of 2createstudio / carbon-pagination

1. Go to this page and download the library: Download 2createstudio/carbon-pagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

2createstudio / carbon-pagination example snippets

 carbon_pagination('posts'); 
 
	if ( function_exists('carbon_pagination') ) {
		carbon_pagination('posts'); 
	}
	
 Carbon_Pagination_Presenter::display('posts'); 
 
	if ( class_exists('Carbon_Pagination_Presenter') ) {
		Carbon_Pagination_Presenter::display('posts');
	}
	
 
	carbon_pagination('posts', array(
		'wrapper_before' => '<div class="paging">',
		'wrapper_after' => '</div>',
		'enable_first' => false,
		'enable_last' => false,
		'enable_numbers' => false,
		'number_limit' => 5,
	)); 
	
 
	carbon_pagination('posts', array(
		'wrapper_before' => '<div class="paging">',
		'wrapper_after' => '</div>',
		'pages' => array(),
		'current_page' => 1,
		'total_pages' => 1,
		'enable_prev' => true,
		'enable_next' => true,
		'enable_first' => false,
		'enable_last' => false,
		'enable_numbers' => false,
		'enable_current_page_text' => false,
		'number_limit' => -1,
		'large_page_number_limit' => 0,
		'large_page_number_interval' => 10,
		'numbers_wrapper_before' => '<ul>',
		'numbers_wrapper_after' => '</ul>',
		'prev_html' => '<a href="{URL}" class="paging-prev">' . esc_html__( '« Previous Entries', 'crb' ) . '</a>',
		'next_html' => '<a href="{URL}" class="paging-next">' . esc_html__( 'Next Entries »', 'crb' ) . '</a>',
		'first_html' => '<a href="{URL}" class="paging-first"></a>',
		'last_html' => '<a href="{URL}" class="paging-last"></a>',
		'number_html' => '<li><a href="{URL}">{PAGE_NUMBER}</a></li>',
		'current_number_html' => '<li class="current"><a href="{URL}">{PAGE_NUMBER}</a></li>',
		'limiter_html' => '<li class="paging-spacer">...</li>',
		'current_page_html' => '<span class="paging-label">Page {CURRENT_PAGE} of {TOTAL_PAGES}</span>',
		'renderer' => 'Carbon_Pagination_Renderer',
		'collection' => 'Carbon_Pagination_Collection',
	)); 
	
 
	carbon_pagination('posts', array(
		'wrapper_before' => '<nav class="navigation pagination"><div class="nav-links">',
		'wrapper_after' => '</div></nav>',
		'prev_html' => '<a class="prev page-numbers" href="{URL}">Previous page</a>',
		'next_html' => '<a class="next page-numbers" href="{URL}">Next page</a>',
		'first_html' => '<a class="prev page-numbers" href="{URL}">First page</a>',
		'last_html' => '<a class="next page-numbers" href="{URL}">Last page</a>',
		'number_html' => '<a class="page-numbers" href="{URL}"><span class="meta-nav screen-reader-text">Page </span>{PAGE_NUMBER}</a>',
		'current_number_html' => '<span class="page-numbers current"><span class="meta-nav screen-reader-text">Page </span>{PAGE_NUMBER}</span>',
		'current_page_html' => '<span class="page-numbers paging-label">Page {CURRENT_PAGE} of {TOTAL_PAGES}</span>',
		'limiter_html' => '<span class="page-numbers dots">…</span>',
		'numbers_wrapper_before' => '',
		'numbers_wrapper_after' => '',
		'enable_numbers' => true,
		'enable_prev' => true,
		'enable_next' => true,
		'enable_numbers' => true,
		'number_limit' => 3,
		'large_page_number_limit' => 1,
	));