Parašė botanik· 2013 Lap. 6 16:11:05
#1
Sveiki, turiu du paveiksliuku kodus:
<div style="position:fixed;left:20px;" class="left"><img src="http://www.aszinau.eu/left.png" border="0" alt="" title=""/></div>
<div style="position:fixed;right:20px;" class="left"><img src="http://www.aszinau.eu/right.png" border="0" alt="" title=""/></div>
Man reikia priskirti jiems funkcijas, kad mestu i kita puslapi (wordpress). Bandžiau pats darytis paėmęs is pagination kodą, bet nelabai kas gavosi.
Pridedu ir pagination koda, gal pravers. BUSIU LABAI DEKINGAS!
function surfarama_pagination($pages = '', $range = 4)
{
$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)
{
printf( __( '<div class="pagination"><span>Page %1$s of %2$s</span>', 'surfarama'), $paged, $pages );
if($paged > 2 && $paged > $range+1 && $showitems < $pages) printf( __( '<a href="%1$s">« First</a>', 'surfarama' ), get_pagenum_link(1) );
if($paged > 1 && $showitems < $pages) printf( __( '<a href="%1$s">‹ Previous</a>', 'surfarama' ), get_pagenum_link($paged - 1) );
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
}
}
if ($paged < $pages && $showitems < $pages) printf( __( '<a href="%1$s">Next ›</a>', 'surfarama' ), get_pagenum_link($paged + 1) );
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) printf( __( '<a href="%1$s">Last »</a>', 'surfarama' ), get_pagenum_link($pages) );
echo "</div>\n";
}
}
endif;