Tags » Pagination

How to Add WordPress Pagination without a Plugin


Add the following function in your theme function.php


function sandy_pagination($pages = '', $range = 2)
{
	$showitems = ($range * 2)+1;

	global $paged;
	if(empty($paged)) $paged = 1;

	if($pages == '')
	{
		global $wp_query;
		$pages = $wp_query->max_num_pages;
		if(!$pages)
		{
			$pages = 1;
		}
	}

	if(1 != $pages)
	{
		echo "<div class='pagination'>";?>

		<?php //previous_post('%','&laquo;', 'no'); ?> 

		<?php previous_posts_link( __( '&laquo;', 'twentythirteen' ) ); ?>

		<?php
		if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
		if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";

		for ($i=1; $i <= $pages; $i++)
		{
		if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
		{
		echo ($paged == $i)? 311 more words
Wordpress

[Yii Tips] Contoh Pengaturan CGridView

Model

public function search()
 {
 // @todo Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
 $criteria->compare('username',$this->username,true);
 $criteria->compare('password',$this->password,true);
 $criteria->compare('aktivasi',$this->aktivasi,true);
 $criteria->compare('email',$this->email,true); 356 more words
Yii Tips

Join the No OFFSET Movement!

Markus Winand from Use The Index, Luke! did it again. He started an exciting battle against one the biggest flaws in the SQL language:

We’ve blogged about this before… 138 more words

Sql

Code to Display Subpages Content in Parent Page With Pagination

<?php
$ids = array();
$pages = get_pages("child_of=".$post->ID);
if ($pages) {
foreach ($pages as $page) {
$ids[] = $page->ID;
}
}
$paged = (get_query_var("paged")) ? get_query_var("paged") : 1; 107 more words
Sanjay Triumph

How to change wordpress odd pagination in numeric pagination

function medas_numeric_posts_nav() {

if( is_singular() )
return;

global $wp_query;

/** Stop execution if there’s only 1 page */
if( $wp_query->max_num_pages <= 1 )
return;

$paged = get_query_var( ‘paged’ ) ? 306 more words

Wordpress

Perennial Favorites: Features for Longform Writers

We often think that our attention spans have grown shorter with the onslaught of digital media, but in fact longform writing — on WordPress.com and beyond — is… 839 more words

General Advice &amp; Pro Tips

Book Design the LibreOffice Way — Part 5: Setting Page Styles in LibreOffice Writer

by Shawn E. Bell //

Building the right structure and setting up simple-to-navigate hierarchy will reduce the complexity of your manuscript, enhance readability, and improve the reader’s experience. 1,033 more words

Featured