• Smart TabsSmart Magento Product Tabs

    Magento product tabs like never before! Create and edit tabs via the Admin and include them when products meet specific conditions.

WordPress Advanced Custom Fields Integration

WordPress Advanced Custom Fields Integration
5.05.0
£29.99!

The Advanced Custom Fields WordPress plugin makes using custom fields easy. Choose from a comprehensive range of field types, create groups of fields and access this information directly from your Magento templates.

£29.99
Secure CheckoutVersion 1.0.1.0
Buy now & receive WordPress Advanced Custom Fields Integration instantly via email.
Compatible with Magento Community 1.4.2.0 - 1.7.0.2 & Magento Enterprise.

The Advanced Custom Fields plugin is an extremely useful WordPress plugin that allows you to add custom fields to your posts. This is a great way to store extra information about each posts and allows you to have a more bespoke blog.

Installation

To install the extension, either upload the .tgz file you downloaded from your account on FishPig.co.uk to Magento via the Direct Package File Uploader in your Magento Downloader and refresh the cache or extract the .tgz file and merge the files via FTP with your Magento root directory. If you choose to merge the files, you can ignore the package.xml.

For this extension to work, you will also need the Advanced Custom Fields plugin installed in WordPress.

Code Examples

Once you have setup your fields in the WordPress Admin and populated some posts with data, you're probably wondering how to actually access that data in your Magento templates. Fortunately, this is the easy part!

WordPress Integration provides a method on the Post model named getMetaValue(string metaKey). By default this method searches the post meta table in WordPress for a value that has a meta key matching the first parameter of the method. The ACF extension uses an event to alter this method so that if an ACF field exists for the post with this key, this value is returned.

Get an ACF Value for a Post

Here is an example of how to get a ACF field that has a field name of 'my_acf_field'.

<?php $acfValue = $post->getMetaValue('my_acf_field') ?>

This works for all field types available in ACF, including the repeater field. When a repeater field is used, the above method returns an array containing all rows and fields inside each row.

Get an ACF Options Value

The ACF extension now supports the custom options feature of Advanced Custom FIelds. This allows you to specify ACF fields that aren't associated with any particular post, but instead, are global to the blog. These values are like static blocks in Magento, except easy to use and actually useful!

The below code demonstrates how to get an ACF option with a field name of my_acf_option.

<?php $acfOptionsValue = Mage::helper('wp_acf')->getOptionValue('my_acf_option') ?>

Support

If you're having problems with this extension, the first to do is check that you are using the latest version. When upgrading this extension, always upgrade WordPress Integration at the same time, as all development testing is carried out using the latest versions of both extensions.

If your problem persists after upgrading, you get in touch via our contact form and we'll do our best to help you.

Back to top