Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

(sorry for my english) in my theme I Breadcrumbs function. I would like to exclude the categories, can you help me? here's the code:

    function the_breadcrumb() {
    global $post;
if (!is_home()) {
    echo '<a href="'.get_option('home').'">'.home.'</a>';
    if (is_category()) {
        echo " / ";
        echo single_cat_title();
    } elseif(is_single() && !is_attachment()) {
        $cat = get_the_category(); $cat = $cat[0];
        echo " / ";
        echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
        echo " / ";
        echo the_title_shorten(45,'...');
    }       
    elseif (is_search()) {
        echo " / " . cerca;
    }       
    elseif (is_page() && $post->post_parent) {
        echo ' / <a href="'.get_permalink($post->post_parent).'">';
        echo get_the_title($post->post_parent);
        echo "</a> / ";
        echo the_title_shorten(45,'...');       
    }
    elseif (is_page() OR is_attachment()) {
        echo " / "; 
        echo the_title_shorten(45,'...');
    }
    elseif (is_author()) {
        echo wp_title(' / Profilo');
        echo "";
    }
    elseif (is_404()) {
        echo " / "; 
        echo errore_404;
    }       
    elseif (is_archive()) {
        echo wp_title(' / ');       
    }
        }
            }
share|improve this question
add comment

2 Answers

You should use get_categories. It supports an exclude argument.

share|improve this answer
add comment

Change this

if (is_category()) {
    echo " / ";
    echo single_cat_title();
} elseif(is_single() && !is_attachment()) {

to this

if(is_single() && !is_attachment()) {
share|improve this answer
    
Thanks Rarst of the answer, but I meant a specific category (eg, 3 or 4) ..... –  Fask Apr 3 '11 at 6:49
    
@Fask then I am not sure, could you please clarify that? What exactly you want or don't want to happen under which conditions? –  Rarst Apr 3 '11 at 10:42
    
hello I would like to exclude categories 3 and 4 from get_category_parents –  Fask Apr 27 '11 at 16:56
    
@Fask that function doesn't support any arguments to exclude stuff and is recursive on top... It might be easier to modify result with str_replace() or something. –  Rarst Apr 27 '11 at 18:10
    
the fact is I'm not an expert you can help me? –  Fask Apr 27 '11 at 18:51
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.