• Resolved José Firmino

    (@ninho1000)


    Fala galera, me ajuda a remover o nome “Categorias de cursos:” do meu Breadcrumb deixando apenas a categoria “Cursos Técnicos” esse é o código valeu!!!

    Print de como está o breadcrumb

    function bloglite_breadcrumb() {
            global $post;
            echo '<ol class="breadcrumb breadcrumb-double-angle text-white bg-transparent p-0">';
            if (!is_home()) {
                echo '<li><a href="';
                echo get_option('home');
                echo '">';
                echo 'Início';
                echo '</a></li><li class="breadcrumb-item breadcrumb-double-angle"> &nbsp; » &nbsp;</li>';
                // if (is_category() || is_single()) {
                //     echo '<li>';
                //     the_category(' </li><li class="breadcrumb-item"> &nbsp; » &nbsp; </li><li> ');
                //     if (is_single()) {
                //         echo '</li><li class="breadcrumb-item"> &nbsp; » &nbsp; </li><li>';
                //         the_title();
                //         echo '</li>';
                //     }
                // }
                if (is_category() || is_single()) {
                    echo '<li>';
                    the_taxonomies( $args001 );(' </li><li class="breadcrumb-item"> &nbsp; » &nbsp; </li><li> ');
                    if (is_single()) {
                        echo '</li><li class="breadcrumb-item"> &nbsp; » &nbsp; </li><li>';
                        the_title();
                        echo '</li>';
                    }
                }
                 elseif (is_page()) {
                    if($post->post_parent){
                        $anc = get_post_ancestors( $post->ID );
                        $title = get_the_title();
                        foreach ( $anc as $ancestor ) {
                            $output = '<li><a href="'.get_permalink($ancestor).'" title="'.get_the_title($ancestor).'">'.get_the_title($ancestor).'</a></li> <li class="separador">/</li>';
                        }
                        echo $output;
                        echo '<strong title="'.$title.'"> '.$title.'</strong>';
                    } else {
                        echo '<li> <strong >'.get_the_title().'</strong></li>';
                    }
                }
            }
            elseif (is_tag()) { single_tag_title();}
            elseif (is_day()) { echo "<li>Arquivo de "; the_time('j \d\e F \d\e Y'); echo'</li>'; }
            elseif (is_month()) { echo "<li>Arquivo de "; the_time('F \d\e Y'); echo'</li>'; }
            elseif (is_year()) { echo "<li>Arquivo de "; the_time('Y'); echo'</li>'; }
            elseif (is_author()) { echo "<li>Arquivo do autor"; echo'</li>'; }
            elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { echo "<li>Arquivo do blog"; echo'</li>'; }
            elseif (is_search()) { echo "<li>Resultados da pesquisa"; echo'</li>'; }
            echo '</ol>';
        }
    • This topic was modified 5 years, 10 months ago by José Firmino.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The code you posted does not output the actual breadcrumb values, it outputs the breadcrumb container only. Presumably JavaScript fills in the values after the page loads. That JavaScript is what you would need to alter.

    Since the part you wish to remove is apparently a portion of a longer title, it’s difficult to write code that generally removes portions of titles. It may be easiest to add additional JavaScript that runs after the breadcrumb insertion that searches the container for the offending text and removes it. Users may see a brief flash of the entire title before the script gets a chance to modify it.

Viewing 1 replies (of 1 total)
  • The topic ‘Breadcrumb com taxonomias personalizadas’ is closed to new replies.