Support

Account

Home Forums General Issues ACF with plugin YouTube LYTE

Solving

ACF with plugin YouTube LYTE

    • venenum

    • January 31, 2016 at 9:20 pm

    I need to apply WP YouTube Lyte . It works in native field of WP. But not in custom field.
    Author in a support page say to use acf/format_value .
    Is it possible works use ACF with YouTuve LYTE?

    Thanks

    • James

    • February 1, 2016 at 2:02 pm

    Hi @venenum

    Based on the plugin author’s answers, it should be working. You can use a text custom field to input the link and then try this code in your functions.php:

    For ACF v5.

    function my_acf_format_value_v5( $value, $post_id, $field ) {
    	
    	$value = lyte_parse($value);
    	return $value;
    }
    
    add_filter('acf/format_value/name=field_name', 'my_acf_format_value_v5', 10, 3);

    For ACF v4 (free version).

    function my_acf_format_value_v4( $value, $post_id, $field ) {
    
    	if($field['name'] == 'field_name'){
            $value = lyte_parse($value);
        }
    	return $value;
    }
    
    add_filter('acf/format_value_for_api', 'my_acf_format_value_v4', 10, 3);

    Please change the “field_name” with your custom field name.

    I hope this helps!

    • gyrdnv

    • September 15, 2020 at 4:45 pm

    Hi there,

    Apologies for bringing an old thread up, but I too need to use YouTube Lyte with ACF. My problem is that the custom field type I have used for the videos is ‘oembed’ and it is mentioned above it should be ‘text’. Is there any way of making it work with the ‘oembed’ type?
    I checked with the YouTube Lyte devs, but they sent me here.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.