[Resolved] Block elements just don’t like BP pages

Home Forums Support [Resolved] Block elements just don’t like BP pages

Home Forums Support Block elements just don’t like BP pages

Viewing 12 posts - 16 through 27 (of 27 total)
  • Author
    Posts
  • #1497653
    Carsten

    Sorry, no difference

    #1498631
    Tom
    Lead Developer
    Lead Developer

    Any chance you can provide temporary admin login details so I can take a closer look?

    #1498640
    Carsten

    Sure, thanks for looking into this.

    #1498897
    Tom
    Lead Developer
    Lead Developer

    Perhaps that conditional from BP isn’t working.

    Does this add anything to the page?:

    add_action( 'generate_before_header', function() {
        if ( function_exists( 'bp_is_activity' ) && bp_is_activity() ) {
            echo 'activity page';
        }
    } );
    #1498911
    Carsten

    No, sorry

    #1500167
    Tom
    Lead Developer
    Lead Developer

    Strange, all the searching I’ve done points to that being the correct condition.

    Can you disable your caching plugin?

    #1500330
    Carsten

    Hi there, I appreciate your persistence to solve this issue, but no difference with deactivated cache, and with this code

    
    add_action( 'generate_before_header', function() {
        if ( function_exists( 'bp_is_activity' ) && bp_is_activity() ) {
            echo 'activity page';
        }
    } );
    
    add_action( 'bp_before_member_header_meta', 'yzc_add_xprofile_field_data_in_profile_header' );
    
    
    #1500470
    Tom
    Lead Developer
    Lead Developer

    I went into the BuddyPress core code and found when they add the activity class to the body.

    Instead of this:

    if ( function_exists( 'bp_is_activity' ) && bp_is_activity() ) {

    Try this:

    if ( function_exists( 'bp_is_activity_component' ) && bp_is_activity_component() ) {

    #1500488
    Carsten

    Hi, this code only display the text ‘activity page’ in the header?

    How does this code connect the Block Element without id?

    add_action( 'generate_before_header', function() {
       if ( function_exists( 'bp_is_activity_component' ) && bp_is_activity_component() ) {
            echo 'activity page';
        }
    } );
    #1501551
    Tom
    Lead Developer
    Lead Developer

    That function is just to test.

    Now that we know it works, we can do this:

    add_filter( 'generate_block_element_display', function( $display, $element_id ) {
        if ( 123 === $element_id ) {
            if ( function_exists( 'bp_is_activity_component' ) && bp_is_activity_component() ) {
                return true;
            }
        }
    
        return $display;
    }, 10, 2 );
    #1501633
    Carsten

    Hi there, great, it’s working perfectly.

    Thanks a lot for bringing up a solution!

    How do I get the element contained like the rest of the page?
    Block set to to Full width, alternativ is wide width, page content set to contained?

    View post on imgur.com

    Regards
    Carsten

    #1502612
    Tom
    Lead Developer
    Lead Developer

    If you want it to be contained then you should de-select the full-width option (you don’t have to choose full width or wide width).

    Glad we got it working 🙂

Viewing 12 posts - 16 through 27 (of 27 total)
  • You must be logged in to reply to this topic.