• Resolved pedromaiquez

    (@pedromaiquez)


    Hi,

    How could I add breadcrumbs to the theme? I am using Yoast for SEO, is there some way to substitute the category meta for breadcrumbs that can be validated for Google?

    Thanks in advance,

    Pedro

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @pedromaiquez,

    Your best bet would be to create a child theme, add a function hooked to one of the actions in Chaplin, and output the breadcrumbs in said function. Add the following code to a functions.php file in your child theme, and it will output the Yoast breadcrumbs in the bottom of the archive header:

    function chaplin_child_breadcrumbs( $post_id ) {
    	yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );
    }
    add_action( 'chaplin_entry_header_end', 'chaplin_child_breadcrumbs', 10, 1 );

    Make sure you’re running version 2.3.0 of Chaplin. Let me know how it goes.

    — Anders

    This is what I have done, for breadcrumb.
    I used Breadcrumb NavXT plugin (so the function is bcn_display.

    In my child theme functions.php I put

    add_action( 'chaplin_entry_header_start', 'add_breadcrumb' );
    add_action( 'chaplin_archive_header_start', 'add_breadcrumb' );
    
    function add_breadcrumb() {
    if(function_exists('bcn_display') && !is_page('PAGE_ID1') && !is_page('PAGE_ID2')):?>
    <div class="breadcrumbs-wrapper" style="background-color: #FFFFFF">
    <div class="breadcrumbs color-secondary" typeof="BreadcrumbList" vocab="https://schema.org/">
        <?php bcn_display();?>
    </div>
    </div>
    <?php endif;
    }

    ( In the function I removed breadcrumb from two pages, but this is just something I needed).

    And in CSS:

    /* breadcrumb */
    .home .breadcrumbs-wrapper {
    	display: none;
    }
    
    .breadcrumbs-wrapper {
    	margin-top: 0rem;
    	margin-bottom: 1.5rem;
    }
    
    .breadcrumbs {
    	font-size: 1.5rem;
    	font-weight: 100;
    	font-style: italic;
    }

    Bye

    One more solution, if you do not want to rely on plugins, you can use the code here https://blog.kulturbanause.de/2011/08/wordpress-breadcrumb-navigation-ohne-plugin/ (in German) or here https://dimox.net/wordpress-breadcrumbs-without-a-plugin/ (English original) in functions.php to build breadcrumbs and then add the following snippet (below the above code) to display the breadcrumbs in Chaplin:

    add_action( 'chaplin_entry_header_start', 'add_breadcrumb' );
    add_action( 'chaplin_archive_header_start', 'add_breadcrumb' );
    function add_breadcrumb() {
    if(function_exists('nav_breadcrumb') 
    	// Ommitted IDs, optional: 
    	// && !is_page('PAGE_ID1') && !is_page('PAGE_ID2') 
    ):?>
    <div class="breadcrumbs-wrapper">
    <div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">
        <?php nav_breadcrumb();?>
    </div>
    </div>
    <?php endif;
    }
    • This reply was modified 4 years, 4 months ago by mniggemann.
    • This reply was modified 4 years, 4 months ago by mniggemann.
    jenny4lexvisa

    (@jenny4lexvisa)

    Will you ever add native breadcrumb support to this theme?

    Theme Author Anders Norén

    (@anlino)

    Hi all,

    Native breadcrumbs were added in version 2.6.0 of the theme, which is out now. They can be enabled by going to Appearance → Customize → Theme Options → General Options → Show Breadcrumbs.

    — Anders

    Hi Andres,
    how can i enable breadcrumbs only for articles and disable for pages?
    Thanks!
    Davide

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add breadcrumbs’ is closed to new replies.