Skip to:
Content
Pages
Categories
Search
Top
Bottom

I can't overwrite the bbPress codes ?


  • Shmoo
    Participant

    @macpresss

    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.
    http://twitter.github.com/bootstrap/components.html

Viewing 3 replies - 1 through 3 (of 3 total)

  • Shmoo
    Participant

    @macpresss

    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..
    http://i46.tinypic.com/33z93lg.png

    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.
    http://twitter.github.com/bootstrap/components.html#breadcrumbs

    Step 1:
    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 *
    http://pastebin.com/bWdPEXa5

    Step 2:
    Open your theme functions.php file and add this code to it.
    http://pastebin.com/nJ9pZinq

    Step 3:
    Open the bbPress or WordPress stylesheet and add those few lines of CSS to it.
    http://pastebin.com/KyPuknTw

    Step 4:
    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..


    Shmoo
    Participant

    @macpresss

    Step 4:

    The code is a bit messy.
    Here is the code in Pastebin.

    http://pastebin.com/0iA4ReV9

    Change the default to the NEW and you’re done.


    Stephen Edgar
    Keymaster

    @netweb

    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 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar