Answers for "wordpress get categories"

1

wordpress print all categories

$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>';
}
Posted by: Guest on June-01-2021
1

wordpress print all categories

$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>';
}
Posted by: Guest on June-01-2021
1

get the category wp

//get category name foolproof 
echo (!empty(get_the_category($post)) ? get_the_category($post)[0]->name : '');
Posted by: Guest on September-09-2021
1

get the category wp

//get category name foolproof 
echo (!empty(get_the_category($post)) ? get_the_category($post)[0]->name : '');
Posted by: Guest on September-09-2021
0

get_categories not__in

$categories = get_categories(array(
  'exclude' => $post_id,
));
Posted by: Guest on October-21-2020
0

get_categories not__in

$categories = get_categories(array(
  'exclude' => $post_id,
));
Posted by: Guest on October-21-2020

Code answers related to "wordpress get categories"

Browse Popular Code Answers by Language