Forums

limit number of categories per page on a category list page? (8 posts)

  1. gbaka
    Member
    Posted 2 years ago #

    in the i created a page with all the category links i was wondering to limit the amount of links per page like for post how it controls number of post per page, also if anyone knows how to make links that make it show links that begin with A or B etc... that be helpful too.

  2. gbaka
    Member
    Posted 2 years ago #

    <?php
    $categories = get_categories();
    foreach ($categories as $cat) {
    	if ($cat->category_parent != 0) {
    		echo '<span style="padding-left:10px;">';
    	}
    	echo '<a href="'.get_option('home').get_option('category_base').'/'.$cat->category_nicename.'/">'.$cat->cat_name.'</a> ('.$cat->category_count.')';
    	if ($cat->category_description != '') {
    		echo ' - '.$cat->category_description;
    	}
    	if ($cat->category_parent != 0) {
    		echo '</span>';
    	}
    	echo '<br />';
    }
    ?>

    I'm using this code to get the category list how woul i limit the amount shown per page?

  3. MichaelH
    Volunteer
    Posted 2 years ago #

  4. gbaka
    Member
    Posted 2 years ago #

    I get a weird error when i place the code in, either it doesn't work or I don't know how to use it probably the ladder tho...

  5. jrav001
    Member
    Posted 2 years ago #

    What does the error say?

  6. gbaka
    Member
    Posted 2 years ago #

    theres a error line 84...

  7. gbaka
    Member
    Posted 2 years ago #

    this is for limiting number categories per page on a category list page if the title doesn't convey the message well enough...

  8. MichaelH
    Volunteer
    Posted 2 years ago #

    Title moderated.

Topic Closed

This topic has been closed to new replies.

About this Topic