Site logo

Archived topic

Code snippet for making layout element work on BP register page

3 replies · Started by Carsten on March 2, 2021

Viewing posts 1–4 of 4

Hi there, it's a known fact that elements targeted at BuddyPress pages just don't work, even if they are listed in the element display roles.

Earlier you have supplied me with a code snippet to make a Block Element work on the Activity page.

add_filter( 'generate_block_element_display', function( $display, $element_id ) {
    if ( 42208 === $element_id ) {
        if ( function_exists( 'bp_is_activity_component' ) && bp_is_activity_component() ) {
            return true;
        }
    }

    return $display;
}, 10, 2 );

Now I'm looking for a similar code to make a layout element work on my register page id 34311, something like:

add_filter( 'generate_layout_element_display', function( $display, $element_id ) {
    if ( 34311 === $element_id ) {
        if ( function_exists( 'bp_is_register_component' ) && bp_is_register_component() ) {
            return true;
        }
    }

    return $display;
}, 10, 2 );

But it does not work.
Can you help me with the right syntax for this code?

Thanks!

Hi there, found the tag, it's working now.

Thanks for your help!

No problem :)

This archived topic is closed to new replies.