Seitenzahlen funktionieren nicht.

  • 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?

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • habe die Lösung gefunden nach langen suchen.

    der Fehler liegt im Aufrufen. Pagnagtion funktioniert nicht wenn man new Query benutz.

    Hier die funktionierende Version.

    <?php global $query_string;
    parse_str( $query_string, $my_query_array );
    $paged = ( isset( $my_query_array['paged'] ) && !empty( $my_query_array['paged'] ) ) ? $my_query_array['paged'] : 1;
    query_posts('post_type=post&posts_per_page=10&paged='.$paged); ?>

    <ul class="recent-posts">
    <?php while (have_posts()) : the_post(); ?>
    <div id="beitrag_start" class="<?php return_category_color(); ?>">
    <div class="beitrag_datum"><span id ="beitrag_datum1"> <?php the_time('j') ?> </span><span id ="beitrag_datum2"> <?php the_time(' M ') ?> </span></div>
    <span id="beitrag_titel"><li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li></span><span id="beitrag_autor">Beitrag erstellt von: <?php the_author_posts_link() ?></span>
    </div>


    <?php endwhile;?>


    <span id="such_link"><p align="center"><?php echo pagination(2, true, true); ?></p></span>

    anstatt von :

    [COLOR=#000080]<?php $publikation = new WP_Query('cat=19&orderby=asc'); if ($publikation->[/COLOR]have_posts()) :?> [COLOR=#000080]<?php while ($publikation->[/COLOR]have_posts()) : $publikation->the_post(); ?> [COLOR=#000080]<div class=[COLOR=#0000FF]"publikation-content"[/COLOR]>[/COLOR] [COLOR=#000080]<div class=[COLOR=#0000FF]"publikation-content-a"[/COLOR]>[/COLOR] [COLOR=#000080]<?php the_title();?>[/COLOR] [COLOR=#000080]</div>[/COLOR] [COLOR=#000080]<div class=[COLOR=#0000FF]"pub-content"[/COLOR]>[/COLOR] [COLOR=#000080]<?php the_content(); ?>[/COLOR] [COLOR=#000080]</div>[/COLOR] [COLOR=#000080]</div>[/COLOR]
    [COLOR=#000080]<?php endwhile; ?>[/COLOR] [COLOR=#000080]<span id=[COLOR=#0000FF]"such_link"[/COLOR]>[/COLOR][COLOR=#000080]<p align=[COLOR=#0000FF]"center"[/COLOR]>[/COLOR][COLOR=#000080]<?php echo wp_schools_pagination(); ?>[/COLOR][COLOR=#000080]</p>[/COLOR][COLOR=#000080]</span>[/COLOR] [COLOR=#000080]<?php wp_reset_postdata();?>[/COLOR]
    [COLOR=#000080]<?php endif;?>[/COLOR]

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!