Zyama
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Fixing WordPress
In reply to: Tag page pagination problemI solved this problem by deleting page-navi function in function php and addind Page-Navi plugin.
There was minor problem with css styles, but it take 10 minut to rewrite them.
Forum: Fixing WordPress
In reply to: Tag page pagination problemMay be the problem in page-navi function in function php?
function wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { global $request, $posts_per_page, $wpdb, $paged; if(empty($prelabel)) { $prelabel = '<strong>«</strong>'; } if(empty($nxtlabel)) { $nxtlabel = '<strong>»</strong>'; } $half_pages_to_show = round($pages_to_show/2); if (!is_single()) { if(!is_category()) { preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches); } else { preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches); } $fromwhere = $matches[1]; $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); $max_page = ceil($numposts /$posts_per_page); if(empty($paged)) { $paged = 1; } if($max_page > 1 || $always_show) { echo "$before <div class='Nav'><span>Страниц ($max_page): </span>"; if ($paged >= ($pages_to_show-1)) { echo '<a href="'.get_pagenum_link().'">« В начало</a> ... '; } previous_posts_link($prelabel); for($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { if ($i >= 1 && $i <= $max_page) { if($i == $paged) { echo "<strong class='on'>$i</strong>"; } else { echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> '; } } } next_posts_link($nxtlabel, $max_page); if (($paged+$half_pages_to_show) < ($max_page)) { echo ' ... <a href="'.get_pagenum_link($max_page).'">В конец »</a>'; } echo "</div> $after"; } } }
Forum: Fixing WordPress
In reply to: Tag page pagination problemIt is the same page for archieves and tags, but pagination does not work for tags
<?php get_header(); ?> <!-- Container --> <div class="CON"> <!-- Start SC --> <div class="SC"> <?php is_tag(); ?> <?php if (have_posts()) : ?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h2 class="pagetitle">Архив категории ‘<?php single_cat_title(); ?>’</h2> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h2 class="pagetitle">Сообщения с тегами ‘<?php single_tag_title(); ?>’</h2> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h2 class="pagetitle">Архив за <?php the_time('F jS, Y'); ?></h2> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h2 class="pagetitle">Архив за <?php the_time('F, Y'); ?></h2> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h2 class="pagetitle">Архив за <?php the_time('Y'); ?> год</h2> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <h2 class="pagetitle">Архив сообщений автора</h2> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h2 class="pagetitle">Архивы блога</h2> <?php } ?> <!-- Start Nav --> <?php if (function_exists('wp_pagenavi')) { ?><?php wp_pagenavi(); ?><?php } ?> <!-- End Nav --> <?php while (have_posts()) : the_post(); ?> <div class="Post" id="post-<?php the_ID(); ?>" style="padding: 5px 0px;"> <div class="PostHead" style="margin-left: 0px;"> <h3><a title="Постоянная ссылка на <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <small class="PostAuthor">От: <?php the_author() ?> : <?php the_time('M j,Y') ?></small> <small class="PostCat">В: <?php the_category(', ') ?></small> </div> </div> <?php endwhile; ?> <!-- Start Nav --> <?php if (function_exists('wp_pagenavi')) { ?><?php wp_pagenavi(); ?><?php } ?> <!-- End Nav --> <?php else : ?> <h2 class="pagetitle">Не найдено</h2> <?php endif; ?> </div> <!-- End SC --> <?php get_sidebar(); ?> </div> <!-- End CON --> <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)