{"id":13760009,"url":"https://github.com/jjgrainger/wp-crumbs","last_synced_at":"2025-08-22T13:32:39.381Z","repository":{"id":22379896,"uuid":"25716462","full_name":"jjgrainger/wp-crumbs","owner":"jjgrainger","description":"Simple Wordpress Breadcrumbs","archived":false,"fork":false,"pushed_at":"2021-02-18T10:26:55.000Z","size":19,"stargazers_count":39,"open_issues_count":1,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-03T21:47:33.377Z","etag":null,"topics":["breadcrumbs","wordpress"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jjgrainger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-25T01:58:29.000Z","updated_at":"2025-03-14T03:58:20.000Z","dependencies_parsed_at":"2022-08-20T11:31:19.848Z","dependency_job_id":null,"html_url":"https://github.com/jjgrainger/wp-crumbs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jjgrainger/wp-crumbs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjgrainger%2Fwp-crumbs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjgrainger%2Fwp-crumbs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjgrainger%2Fwp-crumbs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjgrainger%2Fwp-crumbs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jjgrainger","download_url":"https://codeload.github.com/jjgrainger/wp-crumbs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjgrainger%2Fwp-crumbs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270843586,"owners_count":24655421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breadcrumbs","wordpress"],"created_at":"2024-08-03T13:01:02.140Z","updated_at":"2025-08-22T13:32:39.305Z","avatar_url":"https://github.com/jjgrainger.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# WP Crumbs v1.0.2\n\n\u003e Simple Wordpress Breadcrumbs\n\n[![Build Status](https://travis-ci.org/jjgrainger/wp-crumbs.svg?branch=master)](https://travis-ci.org/jjgrainger/wp-crumbs) [![Total Downloads](https://poser.pugx.org/jjgrainger/wp-crumbs/downloads)](https://packagist.org/packages/jjgrainger/wp-crumbs) [![Latest Stable Version](https://poser.pugx.org/jjgrainger/wp-crumbs/v/stable)](https://packagist.org/packages/jjgrainger/wp-crumbs) [![License](https://poser.pugx.org/jjgrainger/wp-crumbs/license)](https://packagist.org/packages/jjgrainger/wp-crumbs)\n\n## Requirements\n\n* PHP \u003e= 7.2\n* [Composer](https://getcomposer.org/)\n* [WordPress](https://wordpress.org) 5.3.2\n\n## Installation\n\n```\n$ composer require jjgrainger/wp-crumbs\n```\n\n## Usage\n\n#### Basic usage\n\nUse `the_crumbs` to display the breadcrumbs in your template.\n\n```php\nthe_crumbs();\n```\n\n## Options\n\nAn optional array of arguments can be passed to modify the breadcrumb output.\nThe defaults for each option are display below.\n\n##### Example\n\n```php\nthe_crumbs( [\n    'home'      =\u003e 'Home',   // Title for the Home (front page) link\n    'blog'      =\u003e 'Blog',   // Title for the blog home page\n    'seperator' =\u003e '/',      // Seperator to use between each crumb (string or false)\n    'class'     =\u003e 'crumbs', // The class(es) applied to the wrapper element ('crumbs', 'nav crumbs')\n    'element'   =\u003e 'nav'     // The HTML element to use (div, nav, ol, ul)\n] );\n```\n\n##### Output\n\n```html\n\u003cnav class=\"crumbs\"\u003e\n    \u003ca href=\"http://site.com/\"\u003eHome\u003c/a\u003e\n    \u003cspan class=\"sep\"\u003e/\u003c/span\u003e\n    \u003ca href=\"http://site.com/blog/\"\u003eBlog\u003c/a\u003e\n    \u003cspan class=\"sep\"\u003e/\u003c/span\u003e\n    \u003cspan\u003eSingle Post Title\u003c/a\u003e\n\u003c/nav\u003e\n```\n\n\n## Advanced usage\n\n#### get_crumbs()\n\nUse `get_crumbs()` to retrieve an array of crumbs. Each crumb has a `title` and `url`.\n\n##### Example\n\n```php\n$breadcrumbs = get_crumbs();\n\nprint_r( $breadcrumbs );\n```\n\n##### Output\n```php\nArray(\n    [0] =\u003e Array(\n        [title] =\u003e \"Home\"\n        [url] =\u003e \"http://site.com/\"\n    )\n    [1] =\u003e Array(\n        [title] =\u003e \"Blog\"\n        [url] =\u003e \"http://site.com/blog/\"\n    )\n    [2] =\u003e Array(\n        [title] =\u003e \"My First Post\"\n        [url] =\u003e false\n    )\n)\n```\n\nYou can modify the returned array and/or create a function to create an output of your choosing.\n\n`get_crumbs` accepts the same aguments as `the_crumbs`.\n\n#### Filters\n\nYou can further modify the crumbs array using a filter on `get_crumbs`. This will also effect the output of `the_crumbs`.\n\n##### Example\n\n```php\n\n// Example: modify title for a custom post type\nfunction modify_crumbs( $crumbs ) {\n    // if on events archive change title to shows\n    if ( is_post_type_archive( 'event' ) || is_singular( 'event' ) ) {\n        for ( $i = 0; $i \u003c count($crumbs); $i++ ) {\n            if ( $crumbs[$i]['title'] === 'Events' ) {\n                $crumbs[$i]['title'] = \"Shows\";\n            }\n        }\n    }\n\n    return $crumbs;\n}\n\nadd_filter( 'get_crumbs', 'modify_crumbs' );\n```\n\n#### array_insert()\n\n`array_insert()` is a function that allows you to insert a new element into an array at a specific index.\n[You can see a gist of it here](https://gist.github.com/jjgrainger/845271930a319079b74b).\n\nwhen modifying the crumb trail you can add new crumbs at specific points.\n\n##### Example\n\n```php\n// Example: add post type archive on taxonomy archive page\nfunction modify_crumbs( $crumbs ) {\n    // if on the events category archive page\n    if ( is_tax( 'event-categories' ) ) {\n        // create a new crumb\n        $crumb = [\n            'title' =\u003e \"Shows\",\n            'url'   =\u003e site_url( '/shows' ),\n        ];\n\n        // add the new crumb at the index of 1\n        $crumbs = array_insert( $crumbs, $crumb, 1 );\n    }\n\n    return $crumbs;\n}\n\nadd_filter( 'get_crumbs', 'modify_crumbs' );\n```\n\n## Notes\n\n* Licensed under the [MIT License](https://github.com/jjgrainger/wp-crumbs/blob/master/LICENSE)\n* Maintained under the [Semantic Versioning Guide](http://semver.org)\n\n## Author\n\n**Joe Grainger**\n\n* [https://jjgrainger.co.uk](https://jjgrainger.co.uk)\n* [https://twitter.com/jjgrainger](https://twitter.com/jjgrainger)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjgrainger%2Fwp-crumbs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjjgrainger%2Fwp-crumbs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjgrainger%2Fwp-crumbs/lists"}