Answer the question
In order to leave comments, you need to log in
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
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;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question