-1

How can I add a breadcrumb trail to the top of every page of my site? I wait to to look like: "You are here: (page name)"

1 Answer 1

0

Try a breadcrumbs plugin. Breadcrumb NavXT is a popular option I believe.

An alternative solution of is just printing the name of the current page. Here's what such a function might look like in its most basic form:

function wpse_87332_nav_identifier() {
    $page_name = get_the_title();
    echo "You are here: " . $page_name; 
}

Note that this will only work on single pages (posts, pages, media and custom post types etc.), and you'll have to add some logic to display titles for archive pages.

5
  • is there any other option apart from using plugin?
    – user27634
    Commented Feb 18, 2013 at 7:25
  • I want something like this- You are here: Home>> Name of menu >> Name of submenu
    – user27634
    Commented Feb 18, 2013 at 7:28
  • 1
    There is no built in breadcrumbs function in WordPress, but off course you can implement something yourself, but using a plugin is by far the simplest. I've updated my answer with an alternative solution.
    – Simon
    Commented Feb 18, 2013 at 7:36
  • In response to you second comment, if breadcrumbs is what you want, and you don't feel like spending the time developing your own breadcrumbs plugin, use any of the ones readily available. This functionality is not included in WordPress and there are no shortcuts.
    – Simon
    Commented Feb 18, 2013 at 7:38
  • thank you for your support, I am trying to use the function
    – user27634
    Commented Feb 18, 2013 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.