Skip to:
Content
Pages
Categories
Search
Top
Bottom

Pesky sub forum formatting


  • Martin
    Participant

    @rastarr

    Well, I’ve upgraded and facing the issue with the formatting of sub forums.

    Anyone have a clue to the CSS snippet needed to format sub forums as a bulletted list?
    Any help would be great
    Martin

Viewing 25 replies - 1 through 25 (of 29 total)

  • Lynq
    Participant

    @lynq

    Hey Rastarr!

    Are you talking about the list underneath a forum which is seperated by commas?

    If so then you need to specify some arguments to bbp_list_forums like so:

    <?php bbp_list_forums( array (
    ‘before’ => ‘<ul class="bbp-forums-list">’,
    ‘after’ => ‘</ul>’,
    ‘link_before’ => ‘<li class="bbp-forum">’,
    ‘link_after’ => ‘</li>’,
    ‘count_before’ => ”,
    ‘count_after’ => ”,
    ‘count_sep’ => ”,
    ‘separator’ => ”,
    ‘forum_id’ => ”,
    ‘show_topic_count’ => true,
    ‘show_reply_count’ => true,
    )); ?>

    Give that a go, it needs to be changed inside loop-single-forum.php Good luck!

    • This reply was modified 12 years, 4 months ago by Lynq.
    • This reply was modified 12 years, 4 months ago by Lynq.

    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Lynq is 100% correct. Nice work!


    Martin
    Participant

    @rastarr

    well I get a bit of an error, like so:

    Parse error: syntax error, unexpected T_CLASS, expecting ')' in /Users/MartinC/Sites/gaj/wp-content/plugins/bbpress/bbp-theme-compat/bbpress/loop-single-forum.php on line 25
    
    Warning: missing endblock() for startblock('middle') in /Users/MartinC/Sites/gaj/wp-content/themes/parallelus-mingle/framework/theme-functions/layout-and-design.php on line 137
    

    Any ideas?
    Would have preferred to do it via CSS since hacking the core code will get overwriten but if it can’t be helped then it can’t.

    No idea on this error though.
    Thanks for any help
    Martin


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    No no no. Don’t hack core. Copy whichever template file has this call to it, directly into your theme, in the same location it is in bbp-theme-compatibility. Use the code above, but correctly formatted.


    Lynq
    Participant

    @lynq

    Hi Martin,

    You should not edit the core code.

    Inside your template files is a file called loop-single-forum.php, this file calls the bbPress function bbp_list_forums();

    You will notice that it is probably not specifying any arguments it just specifies bbp_list_forums();

    If you specify arguments for that function like the ones listed above it will then wrap the subforums inside li tags which you can then use CSS to style.

    Good luck!

    P.s if you want to find out more about how that function works it is inside /bbpress/bbp-includes/bbp-forum-template.php but you do not need to edit it.

    Seeing how this will format:

    $args = array (
            'before'            => '',
            'after'             => '',
            'link_before'       => '',
            'link_after'        => '',
            'count_before'      => '',
            'count_after'       => '',
            'count_sep'         => '',
            'separator'         => '',
            'forum_id'          => '',
            'show_topic_count'  => true,
            'show_reply_count'  => true
    );
    
    bbp_list_forums( $args );
    
    • This reply was modified 12 years, 4 months ago by Lynq. Reason: Reformatting the code

    Martin
    Participant

    @rastarr

    If only had I some idea what you were talking about.

    I’ve now finally understood the cryptic comment on formatting that was mentioned previously and that refers to the altered , and “

    I’ve created a directory under my main theme directory which is theme/bbp-theme-compat/bbpress and that final subdirectory has now got the file called loop-single-forum.php in it.

    Is this what was meant by placing that file under the active theme?

    Apologies for not being sharp on coding here. Some comments just go straight over some people’s heads.

    Cheers
    Martin


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Close. 🙂

    theme/bbpress/loop-single-forum.php

    …is all you need.


    Martin
    Participant

    @rastarr

    Oh cool, thx – now moved. Now I get this error:

    Parse error: syntax error, unexpected T_STRING, expecting ‘)’ in /Users/MartinC/Sites/gaj/wp-content/themes/parallelus-mingle/bbpress/loop-single-forum.php on line 43

    Warning: missing endblock() for startblock(‘middle’) in /Users/MartinC/Sites/gaj/wp-content/themes/parallelus-mingle/framework/theme-functions/layout-and-design.php on line 137

    Still without a clue 🙂


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Welcome to the life of a developer. Read the error message, and fix what it’s telling you. 🙂

    Hint: You’re missing a ‘)’ or something else is in the way of the ‘)’ that’s there.


    Martin
    Participant

    @rastarr

    Line 43 is now:

    Unsure where the missing ‘)’ is. This is so incredibly frustrating for a non-coder to make a minor adjustment.


    Lynq
    Participant

    @lynq

    What code do you have on line 43?


    Martin
    Participant

    @rastarr

    I’ve looked at pasting it here 4 times but no luck.

    https://skitch.com/rastarr/egkbi/shades – only way I know how to show you 🙂

    • This reply was modified 12 years, 4 months ago by Martin.

    Lynq
    Participant

    @lynq

    If you paste it and then select the text, then click the {} button just above that should format it as code for you.

    It is probably before line 43 where the error lies and is not closing something off, so PHP continues happily until it hits line 43.


    Martin
    Participant

    @rastarr

    The stuff above it is the code you gave me so that is probably where the issue must be.
    But I don’t know what could be wrong. Goodness this is so crazy.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Goodness this is so crazy.

    Do this a few thousand times a day, and you get used to it very quickly.


    Lynq
    Participant

    @lynq

    @Rastarr I have a feeling that when I used the backticks it cut off some of the code and you might of copied that across so it was formatted incorrectly?

    Hmm sorry Rastarr, I can’t get the code formatting to display correctly currently.

    http://pastebin.com/qsuEvBgL

    • This reply was modified 12 years, 4 months ago by Lynq.
    • This reply was modified 12 years, 4 months ago by Lynq.
    • This reply was modified 12 years, 4 months ago by Lynq.

    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @lynq – Maybe give him a function he can drop in his functions.php instead. Then he can just replace the function in his template with yours?


    Lynq
    Participant

    @lynq

    Ok cool,

    Here is the function I am using on one of my bbPress sites (without the modifications).

    1) Copy this function from pastebin: http://pastebin.com/xbwfL71X
    2) Then paste it into your functions.php file.
    3) Inside loop-single-forum.php replace bbp_list_forums(); with custom_bbp_list_forums();

    Good luck!

    • This reply was modified 12 years, 4 months ago by Lynq.

    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @lynq – A bit overkill, since you could have just passed an array into bbp_list_forums() like you were trying to get him to do yourself. 🙂


    Lynq
    Participant

    @lynq

    Oh yea, I did some copying across from my forum, my bad.

    This would be the better choice: http://pastebin.com/rxRm1HiV

    • This reply was modified 12 years, 4 months ago by Lynq.
    • This reply was modified 12 years, 4 months ago by Lynq.

    Martin
    Participant

    @rastarr

    omg, so am I copying the file bbpress-functions.php into the theme root and then adding this other code at the bottom and then modding the loop-single-forum.php file?


    Lynq
    Participant

    @lynq

    Put it into your functions file inside your current theme, should be there already?


    Martin
    Participant

    @rastarr

    Done all that.
    Can you check out http://www.geekandjock.com/relationship-forum and suggest what I might have borked up?


    Lynq
    Participant

    @lynq

    Nothing, looks correct to me.

    If you check the markup you now have markup ready for your CSS.

    Now in your css you could add something along the lines of:

    .bbp-forums .bbp-forum-info .bbp-forums-list .bbp-forum {
        display: block;
    }
    

    Martin
    Participant

    @rastarr

    Well, thanks for your efforts.
    Nothing has changed and it still looks crap 🙂

    For all the supposed theme compatibility, this sort of kinda basic stuff is disappointing.
    I’ll have another look since I’ve already spent too many hours just to get a bullet point listing – wow.

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