question about a breadcrumb plugin you recommend

I have a multisite, buddypress, pro site config.

I read this post:
https://premium.wpmudev.org/blog/wordpress-breadcrumbs-seo-ux/

I have installed the recommended plugin, but have not network activated it, as I want to add it on to some but not all sites on the network. I have not activated it yet on any site, because of the notes for installation on this page:

https://wordpress.org/plugins/breadcrumb-navxt/installation/

Can I install that snippet of code directly into "my custom css" for the site I want it installed on, to have it accomplish what it needs to accomplish?

If not, how do I need to modify it? Thanks in advance! Linda @iempoweru

  • Michelle Shull

    Hiya, Linda!

    This code won't work in custom CSS, it's going to go in the header.php file for your theme. If you're using a child theme, this is going to be super easy. If you're not, it's still not going to be hard, we'll just need to do a little good organizing.

    If you're using a child theme:
    Visit your site via FTP, and go to the main WordPress folder. (Where wp-config.php and your three WordPress directories are.) Next, navigate to wp-content > themes > the parent theme for your child theme.

    Copy, don't move, the header.php file to the root folder of your child theme.

    Open/edit that file, and paste the code provided by the note where you want the breadcrumbs to appear. Read through the code, it's going to be mostly Greek to you, but you'll get an idea of what's happening. Your site's main header, the stuff at the top of every page on your site, will be defined here. Depending on how your theme is structured, you might see the code for navigation menus, your site banner, etc. Make sure to paste the breadcrumb code after/below any menus, so it doesn't break up your site in a way you don't want.

    If you're not using a child theme:

    The plan is essentially the same, only you're going to edit the header.php file that's in your theme's directory, not a new version in a child theme. This means this file will be overwritten the next time your theme updates, so it's important to write yourself a note so you can easily re-do this edit after the next theme update.

    Does this make sense? I added the header.php code from a default WP theme here, so you can see roughly what you're looking for. (The code in your theme will be different.)

    <body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
    	<?php if ( get_header_image() ) : ?>
    	<div id="site-header">
    		<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
    			<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
    		</a>
    	</div>
    	<?php endif; ?>
    
    	<header id="masthead" class="site-header" role="banner">
    		<div class="header-main">
    			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    
    			<div class="search-toggle">
    				<a href="#search-container" class="screen-reader-text" aria-expanded="false" aria-controls="search-container"><?php _e( 'Search', 'twentyfourteen' ); ?></a>
    			</div>
    
    			<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
    				<button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button>
    				<a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
    				<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu', 'menu_id' => 'primary-menu' ) ); ?>
    			</nav>
    		</div>
    
    		<div id="search-container" class="search-box-wrapper hide">
    			<div class="search-box">
    				<?php get_search_form(); ?>
    			</div>
    		</div>
    BREADCRUMB CODE WOULD GO HERE
    	</header><!-- #masthead -->

    Hope this helps!

  • iempoweru

    @Michelle Shull
    First of all, thanks for getting back to me so quick, especially on a holiday weekend!

    okey dokey. I am in my ftp and I have the 3 wp files wp-admin, wp-content, wp-includes. I also have located the theme, both the adult and child version. I know I am using the child theme of blogs mu because it says I am in the theme folder in my network dashboard.
    Question #1:
    So, I found the header.php file in the adult version, but, when right clicking I do not get a "copy" option. Ideas?
    Question #2:
    Which is the root of my child theme?
    Question #3:
    These directions look like they will change this theme for every application of blogs mu, which I am ok with, since these are all my sites. Matter of fact, that would be great. But, if I want to do this to other themes, will it automatically change every version of them as well? Some of my clients may not want that to happen on their themes.
    Question #4:
    Also, as far as placement, I am doing this mainly for the structured data testing on google, and of course the reader will benefit. So, where is the best location to put it?

    Have a great day and thanks for you prompt reply and great service! Linda @iempoweru

  • Bojan Radonic

    Hey there Linda, hope you're well today!

    So, I found the header.php file in the adult version, but, when right clicking I do not get a "copy" option. Ideas?

    You can't copy files in FileZilla :slight_frown: What you can do is download the file from your parent theme and then upload it back to your child theme.

    Which is the root of my child theme?

    Your child theme should be located in the same folder as your other themes, from the screenshot the root folder should be /wp-content/themes/blogs-mu-child. Also the header.php you pointed in the screenshot is the correct file.

    These directions look like they will change this theme for every application of blogs mu, which I am ok with, since these are all my sites. Matter of fact, that would be great. But, if I want to do this to other themes, will it automatically change every version of them as well? Some of my clients may not want that to happen on their themes.

    This will affect only the sites that are using blogs mu child theme that you created. You can always offer your users the parent theme as well which will be unaffected by these changes if it is the parent theme that is activated. This is why using child themes is so great :slight_smile:

    Also, as far as placement, I am doing this mainly for the structured data testing on google, and of course the reader will benefit. So, where is the best location to put it?

    Not really sure what you mean :slight_frown:

    Hope this helps :slight_smile:

    Best regards,
    Bojan

  • iempoweru

    @Bojan Radonic

    Ok sorry to keep hassling you on this one. I think we are almost there. I am sending screenshots to you about what I did and they are numbered as they happened. Two with this post, 2 after.

    I downloaded the header.php file from the blogs mu adult theme
    I uploaded it to the "root" of the blogs mu child theme
    But, shouldn't I be able to see it in directory of the blogs mu child theme like I saw it in the adult version?
    Even though it says I did this, I am not sure I did

    Next, what next? Where do I access the area to "Open/edit that file, and paste the code provided by the note where you want the breadcrumbs to appear"

    And where do I want it to appear? I would think I would want it under the title, before the body, is this right?

    Thanks and once again, sorry to be such a pain. Linda @iempoweru

  • iempoweru

    @Bojan Radonic My apologies for this long string of questions/answers. I resolved it first and then second I found a different more simple solution.

    Even though ftp said it transferred it didn't - at least into the place I wanted it to go. So I went into the file manager of my host and discovered I could copy it from there - much easier for me to see and understand, as I don't use filezilla as much as I do that.

    I activated the plugin and it worked, although not where I wanted it to - so I moved it around a bit and came up with a solution that I liked.

    Then while configuring the plugin, I visited his documentation page. It seems that they now have a sidebar widget that you can add, adjust and you don't have to alter any theme code at all.

    So, I went back to the theme edit page and removed the code completely and now it is done.

    RE: why I wanted to do all of this: google looks more favorably on sites that have a breadcrumb trail.

    Thanks so much for all your help! Linda @iempoweru

  • Bojan Radonic

    Hey Linda,

    Happy to hear you managed to figure this out and get everything to work :slight_smile:

    Using clients such as FileZilla compared to file manager in cpanel is really a matter of preference so if you're more comfortable with that one it's definitely the one that you should use.

    Also you didn't have to remove the code child theme. If your parent theme has that option you could keep the child theme and use the parent one instead. Also creating a child theme should be a good experience for the future since you'll most likely want to make modifications that would require using child theme.

    Please let us know if you have any additional questions :slight_smile:

    Have a great day!

    Cheers,
    Bojan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.