Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #644705

    Hi,

    i have more then one Archivesites and i need a pagination for every site. I make a shortcode in functions.php for each site. When i open the Site the pagination works, i can change the site. The script see how many post i have and make the right numbers of Sites, but i have at every site the same posts.

    i work with this code:
    function kriesi_pagination($pages = ”, $range = 2)
    {
    $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’>”;
    if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo “«“;
    if($paged > 1 && $showitems < $pages) echo ““;

    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>”:”“.$i.”“;
    }
    }

    if ($paged < $pages && $showitems < $pages) echo ““;
    if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo “»“;
    echo “</div>\n”;
    }
    }

    function artikel_zinsimmo() {
    ob_start();
    ?>
    <?php $additional_loop = new WP_Query(“cat=45&paged=$paged&showposts=2”); ?>
    <?php while ($additional_loop->have_posts()) : $additional_loop->the_post(); ?>
    <!– The Post //–>
    <?php endwhile; ?>
    <?php kriesi_pagination($additional_loop->max_num_pages); ?>
    <?php

    $output = ob_get_clean();
    return $output;
    }
    add_shortcode(‘artikel_zins’, ‘artikel_zinsimmo’);

    What can i do?

    Thanks for your replay.

    Andre

    • This topic was modified 8 years, 6 months ago by lightdream68.
    #645386

    Hey lightdream68,

    Thank you for using Enfold.

    Why do you need to do this? There should be a pagination in the archive pages by default. Try to use the avia_pagination function:

    echo "
    <div class='page_nav'>".avia_pagination('', 'nav')."</div>
    ";
    

    Best regards,
    Ismael

    #645402

    Hi Ismael,

    i have for every category a other Layout, with different content to the artikles.

    For this i need a Pagination for all Sites.

    Best regards,

    André

    #646775

    Hi,

    Did you create a new template for the archive page? Did you try the avia_pagination function?

    function artikel_zinsimmo() {
    $output = "
    <div class='page_nav'>".avia_pagination('', 'nav')."</div>
    ";
    echo $output;
    }
    add_shortcode('artikel_zins', 'artikel_zinsimmo');
    

    Best regards,
    Ismael

    #648704

    Hi Ismael,

    thanks for your answer. I don’t have a Child-Theme but i try the avia_pagination. But this not work!

    I send you the link you can see what i mean.

    Best regards

    Andre

    #650059

    Hi,

    Are you trying to use it on pages created with the advance layout builder? I’m sorry but it’s not going to work with ALB. We would like to help but this modification is outside the scope of support. Please hire a freelance developer or contact codeable: http://kriesi.at/contact

    Best regards,
    Ismael

    #650428

    Hi Ismael,

    thanks for your time. I have solved this problem with WP original code.

    Best regards

    Andre

    #650663

    Hi Andre,

    Great, glad you got it working. Please let us know if you should need any more help on the topic.

    Regards,
    Rikard

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.