[Support request] Add a function to a Block element

Home Forums Support [Support request] Add a function to a Block element

Home Forums Support Add a function to a Block element

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1448550
    Carsten

    Hi there, I’m using a block element to add a Heading on my BP profile page using the hook bp_after_profile_content. before there was issues with Elements and BP hook, but now it seems to work, so that is great.

    I want the heading to display on all profiles than own profile, but there are no hook for that. But it is possible to use a function like

    if ( bp_is_my_profile() ) {
    // my profile.
    } else {
    	// not my profile.
    }

    My question is if it would be possible to add such a function to a Block element, like a content field, for adding extra code, like this function?

    Thanks!

    #1448629
    David
    Staff
    Customer Support

    Hi there,

    unfortunately not – Block Elements will not accept PHP.
    You could of course create a shortcode, which can be added using the shortcode block, to output your custom function.

    https://docs.generatepress.com/article/creating-a-shortcode/

    #1448670
    Marcel

    Hello. Sorry I hijack the topic: so for integration with ACF I will need to use shortcodes , right?

    #1448826
    David
    Staff
    Customer Support

    Hi Marcel,

    for now that is correct – we’ll be implementing template tags for the Block Element in GPP 1.13 – this may support some custom fields 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.