Site logo

Archived topic

Woocomerce second title , with custom fields and elements

4 replies · Started by FunkyCss on November 28, 2018

Viewing posts 1–5 of 5

Hallo GP!

I want to ask if is possilbe , with Elements to Display a custom field .

I want to have second title on the woocomerce products , like IRON MAIDEN(CD PRODUCT TITLE) brave new world (Bellow the title)

So i have created with ACF a custom field that i can insert my second title , and i want to make it work with elements ?

Cause when i touched the PhP templates , it crashed some GP CSS styles .

Hey Leo thanks for your Reply but it was not enough . :/

Hey , what i did finally and it works but i believe is not the best way cause i notice some css brakings small , but visible .

So i made with ACF a custom text field for woocomerce products . then i went to Functions.php and i made two actions there .

1. For the Single Product

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
}

2. For the Category of Products

add_action( 'woocommerce_shop_loop_item_title', 'andrew_display_acf_subtitle_on_category_page', 15 );

function andrew_display_acf_subtitle_on_category_page() {
echo get_field('subtitle');
}

* So i am letting this here for the next ones but i would apreciate if there is a way without installing ACF and work with custom fields that wordpress already has , and ELEMENTS.

Thanks for sharing your solution!

This archived topic is closed to new replies.