Drupal Custom Breadcrumb visibility PHP code
I needed to show a custom breadcrumb on specific pages by URL.
The nodes in question were of “page” content type.
The URLs of these nodes were like:
/green
/green/page1
/green/page2
/green/page3 and so on.
I only wanted the custom breadcrumb to show up on:
/green/page1
/green/page2
/green/page3
and not on /green
I created a breadcrumb with title “Green” and path “green” and used this PHP code for visibility:
$p= explode('/', $_REQUEST['q']); return ($p[0] == 'green' && $node->nid != 79);
where 79 is the Node ID of the /green page.
I was able to get the desired result!
Thanks for this solution, it works nicely!