• Resolved miroslav

    (@miroslav)


    Hi,

    My titles are too long. I would like to display the slug part of the URL as text, instead. Is it possible? How to do it? Thanks!

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

    (@mtekk)

    You can write hook into the bcn_breadcrumb_title filter that replaces the passed in title with the appropriate slug to accomplish this. A possibly easier, and more flexible solution would be to use Breadcrumb NavXT Title Trixx (an extension to Breadcrumb NavXT) which allows you manually specify a custom title for any post or taxonomy term. It also has a feature for “importing” slugs as the breadcrumb title for posts.

    Thread Starter miroslav

    (@miroslav)

    Thanks for your reply. Could you give an example of the actual code for the hook?

    Also, would I need to modify the plugin file(s) or only edit my functions.php?

    • This reply was modified 7 years, 9 months ago by miroslav.
    Plugin Author John Havlik

    (@mtekk)

    This is something you would place in a site specific plugin. You should never modify the files shipped with a plugin since your changes will be overwritten when the plugin is updates. I also recommend against using a functions.php since the functionality may still be desired when/if you change themes, additionally, theme updates will overwrite your changes.

    Something like the following should get you started with your filter (will require modification to work):

    
    add_filter('bcn_breadcrumb_title', 'my_breadcrumb_title_filter', 11, 3);
    function my_breadcrumb_title_filter($title, $type, $id)
    {
    if(is_single())
    {
    //Update title with whatever you want here, use the $type array entities and $id to help you
    }
    return $title;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display slug as breadcrumb text?’ is closed to new replies.