Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Disable breadcrumbs
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 8, 2012 - 10:58 am

No, that's the wrong one. Look at end of function - same name but without 'args' in name.

This filter will give you the display code before it's echoed out.

You can thus change it before displayed. In this case you would want to replace the image tags with straight text/problem-with-post-edit-buttontml, likely with a preg_replace() call.

As I said, in this case it's a bit harder and needs php code. I suspect you could Google how to replace img tags with text and find it. As I am away from computer until evening I cannot look up the regex until then.

You could directly edit the function more easily but would lose changes on next upgrade.

Avatar
Jakob Smith
Copenhagen, Denmark
Member
Free Members
sp_UserOfflineSmall Offline
Sep 8, 2012 - 12:05 pm

I've had my first turn of luck with this code in my themes spFunctions.php:

function BreadCrumb_Divider_Replace ($breadCrumbs) {
    $icon_replace_with = " → ";
    $breadCrumbs = preg_replace('/<img[^>]+>/i', $icon_replace_with, $breadCrumbs);
    return $breadCrumbs;
}

add_filter('sph_BreadCrumbs', 'BreadCrumb_Divider_Replace');

The arrows though becomes a part of the links, and there is no spacing, so that's the next thing I need to figure out. it looks like this:

Breadcrumb look

And the generated HTML:

<div id="spBreadCrumbs" class="spBreadCrumbs">
<a class="spLink" href="http://spv2.omkalfatring.dk/"> → Hjem</a><a class="spLink" href="http://spv2.omkalfatring.dk/forum/"> → Forum</a><a class="spLink" href="http://spv2.omkalfatring.dk/forum/okonomi/"> → Økonomi</a></div>
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 8, 2012 - 1:08 pm

cant see all the code in the email on my phone, but looks like your preg_replace might be replace more than just img tags??

will look closer this evening when home if you dont figure it out...

Avatar
Jakob Smith
Copenhagen, Denmark
Member
Free Members
sp_UserOfflineSmall Offline
Sep 8, 2012 - 3:16 pm

Well, the current code in sp-common-view-functions.php places the breadcrumb icon HTML inside the links, so any replacement will also be put there.

My solution for now is:

1) Remove the images from the breadcrumb with the filter (slightly adjusted):

function BreadCrumb_Divider_Replace ($breadCrumbs) {
    $icon_replace_with = "";
    $breadCrumbs = preg_replace('/<img[^>]+>/i', $icon_replace_with, $breadCrumbs);
    return $breadCrumbs;
}

add_filter('sph_BreadCrumbs', 'BreadCrumb_Divider_Replace');

2) Edit lines 1238, 1255, 1265, 1274 and 1280 of sp-common-view-functions.php, placing the → HTML entities in the link code there.

I know 2 is not upgrade-safe, but it's an okay solution for now. After an upgrade it would not take long to correct the code.

Still, I would appreciate the possibility to add the arrows as a divider-argument in sp_BreadCrumbs().

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 8, 2012 - 8:18 pm

so if I understand, you are good for now?

As I said, we hope to implement the ticket for allowing text (or html entity) as the separator in the next version...

Avatar
Jakob Smith
Copenhagen, Denmark
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 3:28 pm

Yes, thank you, I'm good for now :-)

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 3:48 pm

okay, thanks!

Avatar
Jakob Smith
Copenhagen, Denmark
Member
Free Members
sp_UserOfflineSmall Offline
Aug 8, 2013 - 4:45 pm

Jakob Smith said
Well, the current code in sp-common-view-functions.php places the breadcrumb icon HTML inside the links, so any replacement will also be put there.

My solution for now is:

1) Remove the images from the breadcrumb with the filter (slightly adjusted):

function BreadCrumb_Divider_Replace ($breadCrumbs) {
    $icon_replace_with = "";
    $breadCrumbs = preg_replace('/<img[^>]+>/i', $icon_replace_with, $breadCrumbs);
    return $breadCrumbs;
}

 add_filter('sph_BreadCrumbs', 'BreadCrumb_Divider_Replace');

 

2) Edit lines 1238, 1255, 1265, 1274 and 1280 of sp-common-view-functions.php, placing the → HTML entities in the link code there.

I know 2 is not upgrade-safe, but it's an okay solution for now. After an upgrade it would not take long to correct the code.

Still, I would appreciate the possibility to add the arrows as a divider-argument in sp_BreadCrumbs().

I've had to go back to this problem, because my edits in 2) above was overwritten without my knowledge on a clients site.

Referring to the above, has there been any change over the past 11 months which makes it possible for me to put in a divider, which doesn't become part of the links in the breadcrumb?

I have looked here without any luck:

http://codex.simple-press.com/codex/api/template-functions-and-the-api/display-template-functions/common-view/sp_breadcrumbs/

Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Aug 8, 2013 - 11:02 pm

You should be able to turn off the icon images and add text to be shown instead.

I have not tested but would try something like this.

 

sp_BreadCrumbs('tagClass=spLeft spBreadCrumbs&tree=1&homeIcon=&icon=&;iconText=→', __sp('Home'));

Avatar
Jakob Smith
Copenhagen, Denmark
Member
Free Members
sp_UserOfflineSmall Offline
Aug 9, 2013 - 10:51 am

I tried something very close to that, but my problem is that the right arrow becomes part of the link, like in my old post and that doesn't look good when you are displaying breadcrumbs inline.

I would really like the possibility of doing the breadcrumb like this, without editing core files:

HomeBreadcrumbBreadcrumb

Now, with the above code, I'm getting this:

Home → Breadcrumb → Breadcrumb

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626