Site logo

Archived topic

ACF Text Field Style

8 replies · Started by FunkyCss on September 29, 2019

Viewing posts 1–9 of 9

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 .

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.

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 ?

this:

echo get_field('subtitle_');

becomes:

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

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

I corrected a mistake in the code above.

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 !

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

:)))

This archived topic is closed to new replies.