BuddyDev

Search

[Resolved] Buddyblog Pro – Issue with Oembed Type

  • Participant
    Level: Initiated
    Posts: 20
    VITOR MATOS on #47555

    when i try to post in frontend buddyblog section, the new post have a oembed field that dont proper function with the oembed display value form a shortcode:

    ` add_shortcode (‘youtube’, ‘youtube_shortcode’);

    function youtube_shortcode() {
    $youtube = get_field( ‘oembed’);
    return $youtube;
    } `

    this shortcode display the oembed field normal in backend post, but in the buddyblog posting from frontend, this just show a display html:
    https://prnt.sc/Mb9h6vvd781u

  • Keymaster
    (BuddyDev Team)
    Posts: 22498
    Brajesh Singh on #47556

    Hi,
    It does not seem it has any relationship with BuddyBlog as you are using a third party function to return a variable.

    I am assuming that you are using ACF or something similar. You will need to generate the embed markup on your own.

    Here is a way to generate the markup from your value. You can update your shortcode with this

    
    
    add_shortcode( 'youtube', 'youtube_shortcode' );
    
    function youtube_shortcode() {
    	$youtube = get_field( 'oembed' );
    	global $wp_embed;
    
    	return empty( $youtube ) ? '' : $wp_embed->shortcode( array(), $youtube );
    }
    

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 20
    VITOR MATOS on #47563

    this code work perfect but after some time this is happening with the new posts (not old posts)

    https://prnt.sc/b-2JOZgNjBqS

  • Keymaster
    (BuddyDev Team)
    Posts: 22498
    Brajesh Singh on #47568

    Are you putting the shortcode inside the post content?
    Can you please share me the steps to re-create it?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 20
    VITOR MATOS on #47579

    Hey Brajesh, thanks you for all attention, the issue as resolved using the display in the elementor “video” element with the dinamic acf field url and not the oembed shortcode.

    Thank You

  • Keymaster
    (BuddyDev Team)
    Posts: 22498
    Brajesh Singh on #47581

    Thank you.

You must be logged in to reply to this topic.

This topic is: resolved