[Resolved] ACF Text Field Style

Home Forums Support ACF Text Field Style

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1021758
    FunkyCss

    Hi , So i try all this period to style a ACF Field i have given to Woocomerce Subtitles on Products .

    Where i have created a field for the subtitles of products and i show them via function php on my Child theme .

    But i dont know how to target them ?

    I would apreciate any recomendation and any tip or any other practice to make this possible .My website is created on the Merch Site i will give you my url .

    #1021766
    David
    Staff
    Customer Support

    Hi there,

    the ACF field is currently being output as plain text.
    You need to wrap the ACF field code in a HTML element eg.

    <span class="woo-subtitle"><!-- ACF Code here --></span>

    then you can target the woo-subtitle class.

    #1021771
    FunkyCss

    Hi David thanks for the quick response !

    How i wrap the ACF field ? in my php code where is like this ?

    add_action( 'woocommerce_single_product_summary', 'display_acf_field_under_title', 6 );
    function display_acf_field_under_title() {
    echo get_field('subtitle_');
    //'subtitle_' is the slug of the ACF 
    }
    

    Or something else ?

    #1021779
    David
    Staff
    Customer Support

    this:

    echo get_field('subtitle_');

    becomes:

    echo '<span class="woo-subtitle">' . get_field('subtitle_') . '</span>';

    #1021786
    FunkyCss

    Ok i got it ! Thanks but this code maybe is not right cause it brakes the site . and it shows the message this site has technical diffulties . but i got it

    #1021928
    David
    Staff
    Customer Support

    I corrected a mistake in the code above.

    #1021975
    FunkyCss

    Hey David that one worked ! Thank you so much for the tip ! i believe i can do a lot of stuff now with GP & ACF on Woo ! that solves a lot of questions i had ! i am not really good with ACF but i believe is a great combo with elements etc.

    Once again thank you ! i hope you like the site , Merch was the inspiration ! you are the best !

    Cheers !

    #1021978
    David
    Staff
    Customer Support

    Glad to be of help. Love the Site – looks great!

    #1021990
    FunkyCss

    :)))

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