Add a custom field to every public post types in WordPress with Advanced Custom Fields

Add a custom field to every public post type in WordPress by pasting this to your functions.php. Make sure you have Advanced Custom Fields Pro installed and activated. The custom fields will appear as a Option Page in WordPress admin.

 

Print the custom field on the archive page by adding this to the template file.

 

Sort tags and categories with ACF in WordPress

Start by adding a custom field to your tag or category with Advanced Custom Fields, name it to “custom_field” or something, and add this to your functions.php.

 

Modify the tag or category object in the loop by getting the custom field, but it back, sort it and use it how you want.

 

Advanced Custom Fields and GIT in WordPress

Include Advanced Custom Fields or Advanced Custom Fields Pro in your theme and save fields groups as json (pretty awesome). This will allow you to easily version control fields and fieldgroups in GIT. Just move the plugin to your theme folder, rename it to “acf” and create another folder called “acf-fields”. Paste this to your functions.php.

 

Modify ACF post object result to include Polylang language in WordPress admin

Modify the result in a ACF post object field in WordPress admin by including language slug from Polylang. Instead of having multiple object with the same title (but on different languages), add this to your functions.php. Don’t forget to change “field_name” to what ever your field is called.