I can't overwrite the bbPress codes ?
What can i do to overwrite a bbPress Core function and develop my own function..
Let say i want to overwrite the default bbPress breadcrumb tag.
I found the Core code inside a Core-template and i pasted this code inside a new PHP document changed all the bbp_ names of all functions to bbp_shmoo_ > Saved it.
Loaded this new file from the inc. folder into my themes functions.php with the require_once tag..
Change the PHP code inside my forum template from bbp_breadcrumb(); to bbp_shmoo_breadcrumb(); but this doesn’t work, why does it break my theme ?
I need a before_link and after_link array.
This is what a breadcrumb looks like, by default made with a List because it’s a navigation.
Alright guys i’ve got a solution,
Please note, i have ZERO PHP skills so this probably isn’t the best solution on earth but i think it’s a good work-around to get the job done ‘easy’..
If some PHP developer reads this topic and thinks, damn this guy is going crazy with all his copy-/pasting stuff please feel free to modify this code..
What did i do:
First i opened up the Core template file of bbPress where the Breadcrumbs function is made.
I have copied the code and pasted inside a new PHP document, made some simple HTML changes before and after the urls and called this new template file inside my Theme’s functions.php
Last i called my custom Breadcrumb PHP code just to make sure my code is loaded and not the default bbPress code..
Here you go.
When your done it should look like this structure..
Nothing too fancy but the only difference, it’s made by a HTML List , like it should be in 2012 because a Breadcrumbs is a navigation and not just 5 URLs behind each other.
Paste all this code into a new empty PHP document and call it breadcrumbs.php
When your done drop this file into your Themes include folder.
wp-content / themes / [ your-theme-name ] / inc / * here *
Open your theme functions.php file and add this code to it.
Open the bbPress or WordPress stylesheet and add those few lines of CSS to it.
Inside the bbPress template files you often find this line of PHP code, it calls the default Breadcrumb function:
Change that line to this one and your done..
__( '', 'bbpress' ), ) ); ?.>
- without the dots before and after the -> .?.
Hope this helps..
The code is a bit messy.
Here is the code in Pastebin.
Change the default to the NEW and you’re done.
I had been down this path before and now have a patch and the key to it indeed was as you mentioned the before_link and after_link.
The patch is here with example code that should help you out rather that that ^^^ up there 😉
- You must be logged in to reply to this topic.