Hallo ich möchte Seitenzahlen nach 5 Beiträgen anzeigen lassen dies ohne Plugin. Ich habe auch schon einen Code gefunden der bei den Suchergebnissen super funktioniert . nur leider nicht auf eine rSeite wo ich es auc benötige. Dort wird einfach nichts angezeigt.
WP 3.8
http://www.kcserver.info/arithmetica/infonews/publikationen/
Code in der functions.php:
PHP
function pagination($range = 3, $show_one_pager = true, $show_page_hint = false){ global $wp_query; $num_of_pages = (int)$wp_query->max_num_pages;
if(!is_single() && $num_of_pages > 1) { $current_page = get_query_var('paged') === 0 ? 1 : get_query_var('paged'); $num_of_display_pages = ($range * 2) + 1; $output = '<div id="pagination">';
if($show_page_hint) { $output .= '<span>Seite </span>'; } if($current_page > 2 && $current_page > $range + 1 && $num_of_display_pages < $num_of_pages) { $output .= '<a href="' . get_pagenum_link(1) . '" title="Seite 1 - Neueste Artikel">«</a>'; } if($show_one_pager && $current_page > 1) { $output .= '<a href="' . get_pagenum_link($current_page - 1) . '" title="Seite ' . ($current_page - 1) . ' - Neuere Artikel">‹</a>'; }
for($i = 1; $i <= $num_of_pages; $i++) { if($i < $current_page + $range + 1 && $i > $current_page - $range - 1) { if($current_page === $i) { $output .= '<span class="current">' . $i . ' </span>'; } else { $output .= '<a href="' . get_pagenum_link($i) . '" title="Seite ' . $i . '" >' . $i . '</a>'; } } } if($show_one_pager && $current_page < $num_of_pages) { $output .= '<a href="' . get_pagenum_link($current_page + 1) . '" title="Seite ' . ($current_page + 1) . ' - Ältere Artikel">›</a>'; } if($current_page < $num_of_pages - 1 && $current_page + $range < $num_of_pages && $num_of_display_pages < $num_of_pages) { $output .= '<a href="' . get_pagenum_link($num_of_pages) . '" title="Seite ' . $num_of_pages . ' - Älteste Artikel">»</a>'; }
$output .= '</div>';
return $output; }}
Code in dem File wo es auch angezeigt werden soll:
HTML
<div class="wrapper"> <div class="k_breadcrumb"> <?php if (function_exists('wordpress_breadcrumbs')) wordpress_breadcrumbs(); ?> </div> <div id="seminare_content_header"> <div id="s_icon"><img id="s_header_icon" src="<?php bloginfo('stylesheet_directory'); ?>/images/seminare/s_header_icon.png" alt="Seminare" /> </div> <div id="s_h3"> <h1> <?php the_title();?> </h1> </div> <div class="print"><a href="#" title="Seite drucken" onclick="window.print();return false;"><img id="print_icon" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/print.png" alt="Seminare" /></a></div> </div> <div class="pub_gesamt"> <?php $publikation = new WP_Query('cat=19&orderby=asc'); if ($publikation->have_posts()) :?> <?php while ($publikation->have_posts()) : $publikation->the_post(); ?> <div class="publikation-content"> <div class="publikation-content-a"> <?php the_title();?> </div> <div class="pub-content"> <?php the_content(); ?> </div> </div>
<?php endwhile; ?> <span id="such_link"><p align="center"><?php echo wp_schools_pagination(); ?></p></span> <?php wp_reset_postdata();?>
<?php endif;?>
</div></div><div class="clearfix"></div><?php get_footer(); ?>
Wo ist mein fehler das es nicht angezeigt wird?