برچسب: the_category

تابع the_category به جز یک دسته خاص

تابع وردپرس the_category پارامتری که حذف شده باشد را ارائه نمی دهد. برای این کار: function exclude_post_categories($ excl='', $ spacer=' ') { $ categories = get_the_category($ post->ID); if (!empty($ categories)) { $ exclude = $ excl; $ exclude = explode(",", $ exclude); $ thecount = count(get_the_category()) - count($ exclude); foreach ($ categories as $ cat) { $ html = ''; if (!in_array($ cat->cat_ID, $ exclude)) { $ html .= '<a href="' . get_category_link($ cat->cat_ID) . '" '; $ html .= 'title="' . $ cat->cat_name . '">' . $ cat->cat_name . '</a>'; if ($ thecount > 1) { $ html .= ... بیشتر بخوانید