D
D
Dmitry Petrov2015-11-10 10:08:28
WordPress
Dmitry Petrov, 2015-11-10 10:08:28

How to display categories and their custom fields using get_categories()?

Hello. Figured out how to add custom fields in this article.
Now I want to display all categories as tiles on the main page. I decided to use the get_categories() function for this. But I can not figure out how to display the value of the field I created.
Please tell me how can I implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
elesei, 2015-11-10
@elesei

Catch

$get_categories = get_categories($args_cat);
if ($get_categories) {
  foreach ($get_categories as $get_cat) {
     $get_cat_id = $get_cat-> term_id;                   
     $cat_data = get_option("category_$get_cat_id"); 
     $cat_seo_title=$cat_data_['cat_seo_title'];
     echo $cat_seo_title;
   }
}

Roughly speaking

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question