Forums

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

  1. gbaka
    Member
    Posted 2 weeks 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 weeks 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
    moderator
    Posted 2 weeks ago #

  4. gbaka
    Member
    Posted 2 weeks 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 weeks ago #

    What does the error say?

  6. gbaka
    Member
    Posted 2 weeks ago #

    theres a error line 84...

  7. gbaka
    Member
    Posted 2 weeks 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
    moderator
    Posted 2 weeks ago #

    Title moderated.

Reply

You must log in to post.

About this Topic