Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] body_class filter for buddypress pages

Viewing 8 replies - 1 through 8 (of 8 total)
  • Avatar of Hugo
    Hugo
    Moderator

    @hnla

    probably something else! have you checked through the plugin to see how it’s adding to the filter – references to the function aren’t necessary , and anyway that is the output function not a filter as such – BP does hook into the WP filter to add it’s own body classes ( as do I for my own purposes), look through the core files for it.

    As you make no mention of the plugin or having checked what it’s doing I have to say this isn’t a BP issue why would the plugin be adding classes on BP page views, probably knows nothing about them.

    Avatar of Pepperbase
    Pepperbase
    Participant

    @pepperbase

    Hi,

    Well it is a pagelines (a theme) plugin. Here is the plugin code: https://gist.github.com/4077479

    Naturally, I posted this question on their forum. They answered that it is probably a buddypress problem, because they are using a wordpress filter. The plugin does add body classes (for browsers and devices) on all other pages (non buddypress pages).

    Why should this not be working on buddypress pages? Yes. I have little knowledge of buddypress, that is why I am here.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    That code test as working on a local BP install and in a custom BP theme so no it’s not a BP issue as such. All standard BP screens show the class added for the given browser. BP simply grabs the array $classes amd merges it’s own set of classes to that array before it’s rendered to browser, I ran the code from my functions.php so you may have some form of priority issue in when bp is cutting in and grabbing the array to merge to, but this is more to do with your theme I would guess and at what point that function is running. do try testing this function on a plain vanilla BP i.e swap to bp-default to test whether it works.

    On a sidenote be wary of user agent sniffing it has never been considered a suitable way/ method of establish a user agent due to UA spoofing a regular and common practise that historically meant one couldn’t be sure of the query result being valid.

    Avatar of Pepperbase
    Pepperbase
    Participant

    @pepperbase

    I tested the code on the bp-default theme (only wordpress and buddypress activated). It works on normal pages, but not on the buddypress pages (members/activity etc). Hence, it behaves the same as on the pagelines theme.

    I tried different priority settings for the filter in the plugin, but without any results. Any other suggestions I could try?

    Avatar of Pepperbase
    Pepperbase
    Participant

    @pepperbase

    You are right. When I add the code to the bp-default functions.php it works on all pages. Somehow, the priority settings are not working.

    Or at least I am not getting it done.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Well no reason you can’t run it from functions.php is there? I keep my own classes function in a stock functions file for general use where I may need classes in addition to those provided.

    Avatar of Pepperbase
    Pepperbase
    Participant

    @pepperbase

    Hi,

    Pagelines helped me with getting the filter priority right for the plugin. Hence, it is working now!

    Thank you for your help. Very much appreciated!

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Glad it’s working, I’ll mark thread ‘resolved’

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

You must be logged in to reply to this topic.