• Resolved mstudioIL

    (@mstudioil)


    My SEO company want the structure of the breadcrumb to be with OL LI and that the last item will be clickable as link, they also want to edit the breadcrumbs, how can I do this?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter mstudioIL

    (@mstudioil)

    I searched for an answer and didn’t one. I found the examples but they don’t help.

    Plugin Support Maybellyne

    (@maybellyne)

    Hello Mstudioil,

    Thanks for reaching out regarding your breadcrumbs.

    I understand that you want the last node of the breadcrumb path to be clickable. There’s no setting in our plugin to accomplish this. If you are already on the last node, it wont be clickable. The Yoast SEO breadcrumbs are generated based on your site structure. If you want to customize your breadcrumbs, you’ll need to implement one of the filters available in the plugin, for example wpseo_breadcrumb_links in /wordpress-seo/frontend/class-breadcrumbs.php. You can find some examples of use on this link.

    Thread Starter mstudioIL

    (@mstudioil)

    Thanks, one of the examples in the link you sent show how to make the last node to be link.

    The Yoast SEO breadcrumbs are generated based on your site structure

    what do you mean by this?
    I search the examples, but didn’t found how the make the breadcrumbs work as ordered list

    Plugin Support devnihil

    (@devnihil)

    @mstudioil The Yoast SEO breadcrumbs being generated based on your site structure means that the hierarchy that you have configured your sites categories, posts, etc with will be used to generate the breadcrumb links and their order.

    Thread Starter mstudioIL

    (@mstudioil)

    I don’t think you understand me.
    The layout is
    <nav id="breadcrumbs"><span><a href="page-on-site">Home</a> ? <a href="page-on-site">Page</a> ? <a href="page-on-site">Sub page</a></span></nav>
    and I want to know if it can be

    <nav id="breadcrumbs">
    	<ol>
    		<li>
    			<a href="page-on-site">Home</a> ?
    		</li>
    		<li>
    			<a href="page-on-site">Page</a> ?
    		</li>
    		<li>
    			<a href="page-on-site">Sub page</a>
    		</li>
    	</ol>		
     </nav>

    or something like the code

    Plugin Support Maybellyne

    (@maybellyne)

    Thanks for the clarification. I see that you want to change the styling of the breadcrumbs. This can be achieved using CSS. The Yoast SEO plugin does not have this functionality.

    However, we usually recommend identifying the appropriate CSS selectors (as explained in this article) and then changing them to your liking using a plugin like Simple Custom CSS. This plugin will allow you to add your own CSS code to your theme. The CSS changes you add to the plugin will be kept even when the theme is updated. If you need further assistance, you may get in touch with your theme developer.

    Thread Starter mstudioIL

    (@mstudioil)

    How can custom CSS change the styling of the plugin code?

    Plugin Support devnihil

    (@devnihil)

    @mstudioil CSS wouldn’t be able to change the HTML elements of the breadcrumbs, it would only be able to affect the visual styling of them. If you want to modify the HTML elements of the breadcrumbs it would require some amount of custom coding.

    Unfortunately we can’t offer support on custom code. Since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code, we cannot advise you on how to make such changes. Maybe someone watching these forums can assist you further, but if your topic is inactive for 7 days, we’ll mark it as resolved to keep the overview.

    Thank you for your understanding.

    Thread Starter mstudioIL

    (@mstudioil)

    Hey, I looked at you forums but it didn’t help, I ask about the HTML elements because the SEO company the site’s owner is using asked to changed it to what I wrote.
    So maybellyne gave information that won’t help me.
    Why the HTML elements on the plugin are in the way they are and not in list like the SEO company asked it to be?

    amindiary

    (@amindiary)

    Why it marked as resolved? they just suggest to change style! but it MUST be changeable using filters and actions. I need to change markup too like @mstudioil question!

    Thread Starter mstudioIL

    (@mstudioil)

    @amindiary hope they will answer you. I gave up, the SEO is trying to work with the current layout

    amindiary

    (@amindiary)

    @mstudioil I’ve used custom breadcrumb and ignored YOAST one.

    Thread Starter mstudioIL

    (@mstudioil)

    @amindiary
    How do I use this?
    Upload to the child theme folder? or I need to add something in the functsions.php?

    amindiary

    (@amindiary)

    @mstudioil in your case, the code will be below code, add it in function.php and place the_breadcrumb()in your theme where you need to display breadcrumb. and need to add your own css to style it.

    <?php 
    
    /*=============================================
    =            BREADCRUMBS			            =
    =============================================*/
    
    //  to include in functions.php
    function the_breadcrumb() {
    
        $sep = '?';
    
        if (!is_front_page()) {
    	
    	// Start the breadcrumb with a link to your homepage
    echo '<nav id="breadcrumbs">';
            echo '<ol>';
            echo '<li class="breadcrumb-item"><a href="';
            echo get_option('home');
            echo '">';
         bloginfo('name');
            echo '</a></li>' . $sep;
    	echo '<li class="breadcrumb-item active">';
    	// Check if the current page is a category, an archive or a single page. If so show the category or archive name.
            if (is_category() || is_single() ){
                the_category('title_li=');
            } elseif (is_archive() || is_single()){
                if ( is_day() ) {
                    printf( __( '%s', 'text_domain' ), get_the_date() );
                } elseif ( is_month() ) {
                    printf( __( '%s', 'text_domain' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'text_domain' ) ) );
                } elseif ( is_year() ) {
                    printf( __( '%s', 'text_domain' ), get_the_date( _x( 'Y', 'yearly archives date format', 'text_domain' ) ) );
                } else {
                    _e( 'Blog Archives', 'text_domain' );
                }
            }
    	
    	// If the current page is a single post, show its title with the separator
            if (is_single()) {
                echo $sep;
                the_title();
            }
    	
    	// If the current page is a static page, show its title.
            if (is_page()) {
                echo the_title();
            }
    	 
    	// if you have a static page assigned to be you posts list page. It will find the title of the static page and display it. i.e Home >> Blog
            if (is_home()){
                global $post;
                $page_for_posts_id = get_option('page_for_posts');
                if ( $page_for_posts_id ) { 
                    $post = get_post($page_for_posts_id);
                    setup_postdata($post);
                    the_title();
                    rewind_posts();
                }
            }
      echo '</li>';
            echo '</ol>';
     echo '</nav>';
        }
    }
    
    ?>
    Thread Starter mstudioIL

    (@mstudioil)

    Thanks, I will check it.
    I using Elementor pro and the templates I created with it, and OceanWP as theme, so it be tricky

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Changing the breadcrumb’ is closed to new replies.