Title: Using functions.php for outputting ACF
Last modified: November 24, 2021

---

# Using functions.php for outputting ACF

 *  Resolved [themike007](https://wordpress.org/support/users/themike007/)
 * (@themike007)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/using-functions-php-for-outputting-acf/)
 * Hi,
 * I know that this code will work if e edit the child theme or us a code plugin.
 *     ```
       add_action( 'woocommerce_single_product_summary', 'product_subtitle', 5 );
   
       function product_subtitle() { ?>
   
       <?php if(get_field('my_subtitle')) { ?>
       	<div class="style_my_subtitle"><?php the_field('my_subtitle'); ?></div>
       <?php }
       }
       ```
   
 * However I would like to use the functions.php instead and wrap the ACF output
   into a div for styling. If I use the code above in the functions.php i get a 
   critical error. Can you please point me into the correct direction which code
   I have to use to use a div in the functions.php
 * Kind regards,
    Mike

The topic ‘Using functions.php for outputting ACF’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields/assets/icon.svg?rev=3207824)
 * [Advanced Custom Fields (ACF®)](https://wordpress.org/plugins/advanced-custom-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [themike007](https://wordpress.org/support/users/themike007/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/using-functions-php-for-outputting-acf/)
 * Status: resolved