How to add Pagination to foreach loop to page

I create a page in wordpress series.php and here it the code where I block!

    ?php 
        $categories=get_categories(
            array( 'parent' = $cat-cat_ID)
        );

        foreach ($categories as $c) {
            // what you really want instead of var_dump is something to
            // to create markup-- list items maybe, For example
            $idp = $c-term_taxonomy_id;
            //then i get the data from the database
            $cat_data = get_option("category_".$idp);
        ?      

        div class="wide-box"
            !-- Content Detail Box --
            a href="?php echo get_category_link( $idp ); ?" class="wb-image"img src="?php echo $cat_data['original_img']; ?"/a
            !-- Wb Center --
            div class="wb-center"
                h3 class="wb-name"a href="?php echo get_category_link( $idp ); ?"?php echo $c-name; ?/a/h3
                div class="wb-details"
                    Genres : ?php echo $cat_data['genres']; ?br
                    Country : ?php echo $cat_data['country']; ?br
                    Language : ?php echo $cat_data['language']; ?br
                    Year : ?php echo $cat_data['year']; ?
                /div
                div class="latest-label"Latest Episode:/div
                ?php
                    $catquery = new WP_Query( 'cat='.$idp.'posts_per_page=1' );
                    while($catquery-have_posts()) : $catquery-the_post();
                ?
                    a href="?php the_permalink() ?" class="latest-ep"?php the_title(); ?/a
                ?php endwhile; ?
            /div
            !-- Wb Center --
        /div      

    ?php                   
        }
    ?
    /div

So how to add paging for loop to show it?

Topic php categories pagination Wordpress

Category Web


Add this argument to your WP_Query.

'paged' => get_query_var( 'paged' ),

And use a array style of arguments rather than a query post style.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.