Skip to:
Content
Pages
Categories
Search
Top
Bottom

Widget author link hide

  • @barrowr

    Participant

    I’ve added the bbpress Recent Topics as a footer widget in my website. I have adapted the layout fairly well to fit with the theme but I need to hide the text author name but keep the avatar. Better still have the avatar separate to the text so I can position them precisely using css.

    I’ve taken a look at the ‘Editing widgets.php’ and edited to a degree but I need a little more guidance to accomplish the above.

Viewing 8 replies - 1 through 8 (of 8 total)
  • @robin-w

    Moderator

    Think you just need to comment out line 143 of widgets.php
    <h4><?php bbp_user_profile_link( bbp_get_current_user_id() ); ?></h4>

    Then the avatar will show but not the name.

    Line 142 has the avatar code, so you can just use that where you need to put the avatar.

    @jaredatch

    Member

    Note that any modifications you make to bbPress core files will be deleted next time you upgrade.

    @barrowr

    Participant

    Hi Robin,

    Thanks for the advice. I tried that and it had no effect. I actually commented that whole section as a test and no change. Is this the right code snippet to make this change?

    Thanks

    Rob

    @robin-w

    Moderator

    Sorry was being thick and quoted the code for the login display.

    Having had a look at the widget, there is an option in the recent topics widget itself to hide author ie when you add the widget to a sidebar, you get options for no. posts to show, show author, show date etc. – does that not work?

    That links to line 798 in the widgets php, so there would be you next step.

    @barrowr

    Participant

    Thanks Robin.

    If I hide author within the widget options it hides the avatar too, so I can’t go down that route.

    Looked at the coded and I have been amending the lines at 798. Unfortunately no being too php savvy I can’t fathom which part is related to the avatar and the author link. Removing the line removes the avatar and the link. I could do with knowing which part of the code relates to which function.

    Thanks again

    @robin-w

    Moderator

    Have had a bit of a play.

    Answer turns out to be very easy !

    In line 799 just change

    'type' => 'both'
    to

    'type' => 'avatar'

    Then just the avatar displays.

    By the by change it to

    'type' => 'name' and guess what, just the name displays!

    As said earlier make a note of what you have changed, as later upgrades will change this back.

    @barrowr

    Participant

    Thanks Robin, that worked. I can’t believe it was that straight forward. I looked so often at that code snippet but never thought to change it.

    Thanks for your help.

    @robin-w

    Moderator

    I find most of this is straight forward ONCE you know the answer, but like you I can spend hours trying to get something to work !

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