views:

48

answers:

2

Hello!

You can see here what i am doing:

http://www.arvag.net/otkrijte-svet/leto/

So its pulling 2 custom fields from child pages, one of them is just url for the image on the left, and the other field is that text showing on the right.

Now, what i want to do is to add pagination there. The code i have now will just simply show all child pages, but i want to show only 5 child pages, so if user want to see 6th child page he would have to click on link for "Page 2" and so on.

The code im using to display these child pages is this:

<?php
    $pages = get_pages('child_of='.$post->ID.'&sort_column=post_title&sort_order=desc');
    $count = 0;
    foreach($pages as $page)
    {
        $short_info = get_post_meta($page->ID,'info',true);
        $image = get_post_meta($page->ID,'slika',true);
        $count++;
    ?>

        <div class='preview_slika left'><img src="<?php echo $image ?>" alt="<?php echo $page->post_title ?>" /></div>
        <div class='preview_info right'>
            <h2><?php echo $page->post_title ?></h2>
            <p><?php echo $short_info ?></p>
            <a href="<?php echo get_page_link($page->ID) ?>">Više o >></a>
        </div>
        <div class='clear'></div>
    <?php
    }
?>

So any idea what to do to get what i need?

A: 

Take a look at wp-PageNavi plugin. And this blog post if you want to integrate it in your theme an not have another plugin to manage.

Greenie
A: 

Some guy posted some sample code on wordpress forums which works much better for me than this plugin.

http://wordpress.org/support/topic/383773

GaVrA