• Resolved jbonlinea

    (@jbonlinea)


    Hi there,

    I’m impressed with the amount of customisation offered by your plug-in, thank’s for that, yet I can’t find how to do something specific.

    I’ve seen in the documentation that there are some dynamics tags to customise the breadcrum template.

    Isn’t there a dynamic tag that contain the “term slug” ?

    If not (I coldn’t find any) how can I set the breadcrum template with a custom link having this strucutre : /my/custom/url/%term_slug%

    could it be done programamtically ?
    for a given taxonomy ?

    Any help would be greatly appreciated

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Havlik

    (@mtekk)

    The available template tags are covered in the “Templates” section of the Breadcrumb NavXT Documentation: https://mtekk.us/code/breadcrumb-navxt/breadcrumb-navxt-doc/#using_bcn_settings

    There isn’t a dynamic tag for %term_slug%, and while you can add your own template tags, I would not recommend that for this case. Instead, you should use the appropriate WP filter to get the get_term_link() function to return your custom link structure. This method will allow you to use the standard breadcrumb templates, and the other links generated for that term in WordPress will have the custom structure as well.

    Thread Starter jbonlinea

    (@jbonlinea)

    Hi,

    Ok that waht I though, I just wasn’t sure which filter should be used.

    In the end this page helped build what I needed

    Here is y code snippet if someone needs it

    Cheers

    
    

    add_filter(‘bcn_breadcrumb_url’, ‘my_breadcrumb_url_changer’, 3, 10);
    function my_breadcrumb_url_changer($url, $type, $id){

    $taxonomy = ”;

    if(in_array(‘category’, $type) ){

    $term = get_term( $id );

    if ( false !== $term ) {
    $taxonomy = $term->taxonomy;

    if ($taxonomy === ‘category’ && $id != 371){
    $url = get_permalink(’23’) .’?_sft_’ . $taxonomy . ‘=’ . $term->slug ;
    }
    }

    }
    return $url;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Term slug in breadcrum links’ is closed to new replies.