Pagination
-
I don’t get it. None of the pagination plug ins work for me, maybe because of the ambrosesite plug in code we added to functions. But now, when I make a long page broken up with nexttags, I get all kinds of pagination I DONT want and I can’t figure out what’s making them show up. All pagination plug ins are deactivated except the ambrosesite ones. But I don’t believe these are coming from that.
http://juicytravels.com/best-air-travel-sites/5-cool-flight-tracker-sites-multipagetoolkit/
Is there some default pagination that happens when you use nexttag to break up long pages into chunks?
I just tried to install a different kind of pagination…
http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/
So in my child theme functions fie I added:
function 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)
{
echo "<div class="pagination"><span>Page ".$paged." of ".$pages."</span>";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>« First</a>";
if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>";
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) echo "<a href="".get_pagenum_link($paged + 1)."">Next ›</a>";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>";
echo "</div>n";
}
}
if (function_exists("pagination")) {
pagination($additional_loop->max_num_pages);
}
add_action( 'graphene_after_post_content', 'pagination' );
?>the entire page is like this in case there is something above it, like that space or misplaced tags which might be the problem?
<?php
function graphene_slider_post_types(){
return array('post', 'page');
}
add_filter( 'graphene_slider_post_type', 'graphene_slider_post_types' );
// attaches the function my_post_nav to the hook graphene_post_nav
add_action ('graphene_after_post_content', 'my_post_nav');
// our function
function my_post_nav(){
// this will allow us to use other hooks but still only show on single posts
if ( is_single() && ! is_page() ) : ?>
<div id="my-post-nav"> <!-- div to contain your links -->
<?php previous_post_link_plus( array(
'order_by' => 'menu_order',
'loop' => false,
'max_length' => 0,
'tooltip' => 'Previous page',
'in_same_cat' => true,
'ex_cats' => '12'
) );?> |
<?php next_post_link_plus( array(
'order_by' => 'menu_order',
'loop' => false,
'max_length' => 0,
'tooltip' => 'Next page',
'in_same_cat' => true,
'ex_cats' => '12'
) );?>
</div>
<?php endif;
}
/******
* these next two remove the graphene breadcrumb and then add one
* which does not appear on the home page
*****/
// has to be called after the action is added
add_action ('after_setup_theme', 'wmrt_remove_graphene_bc');
function wmrt_remove_graphene_bc() {
remove_action ('graphene_top_content', 'graphene_breadcrumb_navxt');
}
add_action('graphene_top_content', 'wmrt_breadcrumb_navxt');
function wmrt_breadcrumb_navxt () {
//by calling this at this point is_home() works!
if ((function_exists('bcn_display')) && (!(is_front_page()))) {
echo '<div class="breadcrumb">';
bcn_display();
echo '</div>';
}
}
function graphene_filter_gettext( $translated, $original, $domain ) {
$strings = array(
'View full post' => 'Read More',
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );
function laura_sharethis (){
?>
<div id="sharethis"><span class='st_facebook_hcount' displayText='Facebook'></span><span class='st_twitter_hcount' displayText='Tweet'></span><span class='st_plusone_hcount'></span><span class='st_fblike_hcount'></span></div>
<?php
}
add_action( 'graphene_after_post_content', 'laura_sharethis' );
function 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)
{
echo "<div class="pagination"><span>Page ".$paged." of ".$pages."</span>";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>« First</a>";
if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>";
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) echo "<a href="".get_pagenum_link($paged + 1)."">Next ›</a>";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>";
echo "</div>n";
}
}
if (function_exists("pagination")) {
pagination($additional_loop->max_num_pages);
}
add_action( 'graphene_after_post_content', 'pagination' );
?>and in styles I added
}
.pagination {
clear:both;
padding:20px 0;
position:relative;
font-size:11px;
line-height:13px;
}
.pagination span, .pagination a {
display:block;
float:left;
margin: 2px 2px 2px 0;
padding:6px 9px 5px 9px;
text-decoration:none;
width:auto;
color:#fff;
background: #555;
}
.pagination a:hover{
color:#fff;
background: #3279BB;
}
.pagination .current{
padding:6px 9px 5px 9px;
background: #3279BB;
color:#fff;
}But that doesn’t work either.
Why is this pagination thing such a hard thing for me to figure out?
Syahir, can you help please? I’ve been stuck on this for weeks.
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.