Tagged: ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #522995

    Hi there,

    I need to add a custom Breadcrumb to my WooCommerce product pages as the standard one links back to Category pages that I don’t use.

    I need the breadcrumb to be:

    You are here: Home > Products > Product Name

    The code below displays the page/product title separately to the breadcrumbs …

    `add_action( ‘woocommerce_before_single_product_summary’, ‘enfold_customization_woocommerce_extra_text’, 1);
    function enfold_customization_woocommerce_extra_text(){
    echo ‘<p id=”breadcrumbs” style=”padding-top:0px; padding-bottom:20px;”>You are here: <a href=”/”>Home</a> / <a href=”/products”>Products</a> / <strong></strong></p>’;
    wp_title(”);
    }`

    However, I need to incorporate wp_title(”); into the above <p> between the tags.

    When I’ve tried this, it doesn’t work. What do I need to change to get this to work?

    I have added this to the bottom of my child functions.php file.

    http://screencast.com/t/VhQkGFJZ

    #523456

    Hey richardelectrix!

    Thank you for using Enfold.

    If I understand you correctly, you want to remove the product category link in the breadcrumb then add the product title? Please remove the modification then use this instead:

    add_action( 'woocommerce_before_single_product_summary', 'enfold_customization_woocommerce_extra_text', 1);
    function enfold_customization_woocommerce_extra_text(){
    	echo '<div class="product_breadcrumb alternate_color">';
    	echo avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true));
    	echo '</div>';
    }

    If you want to remove the product category, add this:

    add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 2 );
    function avia_breadcrumbs_trail_mod( $trail, $args ) {
    	$id = avia_get_the_ID();
    	if(is_singular('product')) {
    		unset($trail[2]);
        }
    	return $trail;
    }

    Best regards,
    Ismael

    #523584

    Hi

    I have tried that but it is not what I am looking for.

    I literally want it like this …

    We are not using these category pages and dont want users to be able to see them http://dev2.electrixinternational.com/product-category/trunking-systems/flat-lid-trunking-system/

    We are using pages for our category pages are we are able to display the products better and add extra text to introduce them.

    Therefore, we need our breadcrumbs to look like this

    You are here: Home / Products / Flat Lid Trunking | Length

    Which is almost what I have by using this code …

    add_action( 'woocommerce_before_single_product_summary', 'enfold_customization_woocommerce_extra_text', 1);
    
    function enfold_customization_woocommerce_extra_text(){
    
    echo '<p id="breadcrumbs" style="padding-top:0px; padding-bottom:20px;">You are here: <a href="/">Home</a> / <a href="/products">Products</a> / <strong></strong></p>';
    
    wp_title('');
    
    }

    The only problem being I want to display the wp_title(”) between the STRONG tags.

    #524315

    Hey!

    Alright. Replace the code with this:

    add_action( 'woocommerce_before_single_product_summary', 'enfold_customization_woocommerce_extra_text', 1);
    
    function enfold_customization_woocommerce_extra_text() {
    ob_start();
    wp_title('');
    $title = ob_get_clean();
    echo '<p id="breadcrumbs" style="padding-top:0px; padding-bottom:20px;">You are here: <a href="/">Home</a> / <a href="/products">Products</a> / <strong>'.$title.'</strong></p>';
    }

    Cheers!
    Ismael

    #530060

    Excellent Ismael – genius!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Manual Breadcrumbs’ is closed to new replies.