function custom_ad_category_list() {
$output = '
';
$terms = get_terms(array(
'taxonomy' => 'ad_category',
'hide_empty' => false,
'parent' => 0,
));
if (!empty($terms) && !is_wp_error($terms)) {
foreach ($terms as $term) {
if (strpos($term->name, 'نقل') !== false) {
$output .= '- ' . esc_html($term->name) . ' (' . $term->count . ')
';
}
}
} else {
$output .= '- لا توجد تصنيفات حالياً.
';
}
$output .= '
';
return $output;
}
add_shortcode('ad_categories_list', 'custom_ad_category_list');