I am basically looking for a way to display only 3 categories on my template page.
I used a foreach loop to display all the categories on my pages
$categories = get_categories();
foreach($categories as $category) {
echo '<div class="col-md-4"><a href="' .
get_category_link($category->term_id) . '">' . $category->name
. '</a></div>';
}?>
this code displays all the categories on my page but I just want to display 3 per page and eventually add paginations
3
Answers
as per my comments above. the code example I can give you is as follows
though let it be known that this wont fully work as you would think etc… etc… I cant explain the modulus operator in depth as I cant think of an easy way without you trying to learn it so you can understand it well.
this way you are only getting 3