Reputation: 425
I have this problem about my WordPress integration. My problem starts when I start customizing the woo commerce plugin. I make some custom fields using ACF Plugin. My problem is I am not able to display such custom fields on the archived-product.php.
archived-product.php is the shop page right ? But after making some custom fields and point it to ( page == shop ) and calling the custom field with the following code:
<?php the_field('top_image_banner_sub_pages'); ?>
The custom field is still not visible on the archived-product.php. My question is how do I call my custom field so that it would be visible in my shop field ? Your answers are highly appreciated. Thanks a lot Sir/Mam.
Upvotes: 0
Views: 4315
Reputation: 2521
Using ACF for this page is a fine idea. I think your problem is your fields are on your "Shop" page, but in actuality the Shop page that WooCommerce is rendering is not associated with the Shop page ID.
The page that is loading is 'archived-product.php' as you mentioned. So you need to tell ACF exactly where to look by entering the ID of your page. So your code should look like this:
<?php the_field('top_image_banner_sub_pages', 123); ?>
Where 123
is replaced by the ID of your Shop page.
Upvotes: 2
Reputation: 84
Dont use Acf for product custom fields.. please use custom fields of wordpress.
For add meta https://codex.wordpress.org/Function_Reference/add_post_meta
For get meta https://codex.wordpress.org/Function_Reference/get_post_meta
Upvotes: 0