Title: ACF Theme Code for Advanced Custom Fields
Author: Aaron Rutley
Published: <strong>21 juli 2016</strong>
Last modified: 28 november 2023

---

Sök tillägg

![](https://ps.w.org/acf-theme-code/assets/banner-772x250.png?rev=2795416)

Det här tillägget **har inte testats med någon av de 3 senaste huvudversionerna 
av WordPress**. Det kanske inte längre underhålls och kan ha kompatibilitetsproblem
när det används tillsammans med nyare versioner av WordPress.

![](https://ps.w.org/acf-theme-code/assets/icon-256x256.png?rev=1458037)

# ACF Theme Code for Advanced Custom Fields

 Av [Aaron Rutley](https://profiles.wordpress.org/aaronrutley/)

[Ladda ner](https://downloads.wordpress.org/plugin/acf-theme-code.zip)

 * [Detaljer](https://sv.wordpress.org/plugins/acf-theme-code/#description)
 * [Recensioner](https://sv.wordpress.org/plugins/acf-theme-code/#reviews)
 *  [Installation](https://sv.wordpress.org/plugins/acf-theme-code/#installation)
 * [Utveckling](https://sv.wordpress.org/plugins/acf-theme-code/#developers)

 [Support](https://wordpress.org/support/plugin/acf-theme-code/)

## Beskrivning

The _ACF Theme Code_ plugin automatically generates the code needed to implement_
[Advanced Custom Fields](https://en-au.wordpress.org/plugins/advanced-custom-fields/)_
in your themes.

> Video note: This free version of _ACF Theme Code_ now supports ACF 6.

#### Funktioner

**Minska din utvecklingstid .**

 * When you publish, edit or update an ACF Field Group, the code required to implement
   your fields is displayed in the _Theme Code_ section at the bottom of your Edit
   Field Group page.
 * Use the clipboard icons in this section quickly copy and paste the code blocks
   into your theme templates.

**Kvalité, flexibelt, anpassad kod.**

 * The code generated by _Theme Code Pro_ is based on the [official _Advanced Custom Fields_ documentation](https://www.advancedcustomfields.com/resources/)
   and includes [escaping](https://developer.wordpress.org/themes/theme-security/data-sanitization-escaping/#escaping-securing-output)
   for secure output.
 * All code generated has been thoroughly tested and is created with speed and flexibility
   of implementation in mind.

**Omfattande stöd för fält**

 * This version of _ACF Theme Code_ generates code for all the field types included
   in the free version of _[Advanced Custom Fields](https://en-au.wordpress.org/plugins/advanced-custom-fields/)_(
   see the full list of field types and settings below).
 * The code generated is specific to the field names and field settings you use 
   for each of your fields.

#### ACF Theme Code PRO

_**[ACF Theme Code PRO](https://hookturn.io/downloads/acf-theme-code-pro/)**_ is
the premium version of this plugin. It has the following additional features.

 * Support for all the complex field types that are included in _[Advanced Custom Fields PRO](https://www.advancedcustomfields.com/pro/])_.
    - Repeater
    - Flexibelt innehåll
    - Galleri
    - Klona
 * The addition of a _Theme Code Location Registration Tool_ to the ACF _Tools_ 
   page that generates code for registering locations.
    - **Blocks**
    - Alternativsidor
 * Support for more complex ACF Field Group Locations.
    - **Block**
    - Alternativsida
    - Widget
    - Taxonomi
    - Kommentar
    - Bilaga
    - Nuvarande användare
    - Användarformulär
 * Support for a range of third party fields.

**[Uppgradera eller läs mer om ACF Theme Code PRO](https://hookturn.io/downloads/acf-theme-code-pro/)**.

#### ACF fields supported

This free version of _ACF Theme Code_ generates code for the following ACF field
types and settings:

 * Text
 * Textområde
 * Nummer
 * Intervall
 * E-post
 * URL
 * Lösenord
 * Image (return types Array, URL and ID)
 * File (return types Array, URL and ID)
 * WYSIWYG-redigerare
 * oEmbed
 * Select (values Single and Multiple, return types Value, Label and Array)
 * Checkbox (return types Value, Label and Array)
 * Radio Button (return types Value, Label and Array)
 * Button Group (return types Value, Label and Array)
 * Sant/falskt
 * Link (return types Array and URL)
 * Post Object (values Single and Multiple, return types Post Object and Post ID)
 * Page Link (values Single and Multiple)
 * Relationship (return types Post Object and Post ID)
 * Taxonomy (appearances Checkbox, Multi Select, Radio Buttons and Select, return
   types Term Object and Term ID)
 * User (values Single and Multiple, return types User Array, User Object and User
   ID)
 * Google Map
 * Datumväljare
 * Datum/tidväljare
 * Färgväljare
 * Grupp

#### Krav

 * _Advanced Custom Fields_ eller _ACF PRO_ (version 5.8.9 eller högre)

#### Tack

Thanks to all of our beta testers. Including Elliot Condon, Phil Smart, Richard 
Johnston and James Bundey.

#### Translations

Would you like to use the ACF Theme Code plugin in your native language? Then why
not _[contribute a translation](https://translate.wordpress.org/projects/wp-plugins/acf-theme-code/)_
via translate.wordpress.org.

If you are new to translating plugins, there is a helpful _[First Steps](https://make.wordpress.org/polyglots/handbook/translating/first-steps/)_
guide available.

_[View the current state translations for ACF Theme Code](https://translate.wordpress.org/projects/wp-plugins/acf-theme-code/)_.

Any and all assistance with translations is greatly appreciated. Please let us know
if you need any help with submitting translations.

## Skärmdumpar

 * [[
 * The code required to implement each field is displayed for you in the Theme Code
   section.

## Installation

Från din adminpanel i WordPress

 1. Visit _Plugins_ > _Add New_.
 2. Sök efter “ACF Theme Code”.
 3. Activate _ACF Theme Code for Advanced Custom Fields_ from your _Plugins_ page.
 4. _Publish_, _Edit_ or _Update_ an ACF Field Group.
 5. Scroll down the _Edit Field Group_ page to the _Theme Code_ section to see the 
    code generated.

## Vanliga frågor

### Stödjer det här tillägget ACF PRO?

This free version of _ACF Theme Code_ supports all the field types from _ACF PRO_
that are also found in the free version of _Advanced Custom Fields_.

The _[ACF Theme Code PRO](https://hookturn.io/downloads/acf-theme-code-pro/)_ plugin
also supports extra fields found only in _ACF PRO_. These include the Repeater, 
Flexible Content, Gallery and Clone fields. It also supports _ACF PRO_ features **
ACF Blocks** and Options Pages.

### Does this plugin generate the code needed for different field group Locations?

This free version of _ACF Theme Code_ supports all the Post and Page field group
Locations.

The _[ACF Theme Code PRO](https://hookturn.io/downloads/acf-theme-code-pro/)_ plugin
also supports a bunch of other field group Locations. These include **Block**, Options
Page, Widget, Taxonomy, Comment, Attachment, Current User and User Form.

## Recensioner

![](https://secure.gravatar.com/avatar/ffad24b76276b958223f3371aefe6b3bfdb841459bfe18bbe6d24d7e68e10d60?
s=60&d=retro&r=g)

### 󠀁[Nice, thank you](https://wordpress.org/support/topic/nice-thank-you-5/)󠁿

 [charlie67p](https://profiles.wordpress.org/charlie67p/) 26 februari 2024

Simple but helpful ! Thank you

![](https://secure.gravatar.com/avatar/e9f0e6ede60ba2b4e3a9468149a58794f0c8a219cc7ff384d8cc8525fed385a5?
s=60&d=retro&r=g)

### 󠀁[Works Great!](https://wordpress.org/support/topic/work-great-140/)󠁿

 [wightspace](https://profiles.wordpress.org/wightspace/) 14 december 2021 1 svar

I really like this plugin it is very helpful.

![](https://secure.gravatar.com/avatar/dc26b72f27f6c74827ac46d3987e37461221f7a216573aa01c06bc690e200120?
s=60&d=retro&r=g)

### 󠀁[Makes creating custom Blocks a breeze!!!](https://wordpress.org/support/topic/makes-creating-custom-blocks-a-breeze/)󠁿

 [Alicia St Rose](https://profiles.wordpress.org/laughhearty/) 15 november 2021 
1 svar

Yes, there’s the awesome code for each custom field, but where this really shines
for me is the ease at creating the code to register my custom ACF blocks! I recommend
this plugin to other developers constantly! It makes my workflow more efficient 
and delightful!

![](https://secure.gravatar.com/avatar/d46006b4017f007537a2c0dcf966ca7b3a5e0a3c89d2c15a569596da7329d561?
s=60&d=retro&r=g)

### 󠀁[A ”Must Have” plugin for ACF users](https://wordpress.org/support/topic/a-must-have-plugin-for-acf-users/)󠁿

 [Anthony Hortin](https://profiles.wordpress.org/ahortin/) 9 november 2021 1 svar

If you’re using Advanced Custom Fields (ACF), then you gotta get this plugin! It’s
such a HUGE time saver. When you create your ACF fields, this plugin will automatically
generate the PHP code you’ll need, to use those fields in your theme/plugin. No 
more Googling to search for the correct function to implement your ACF fields. This
plugin will save you so much time! Great work guys! 👍👍

![](https://secure.gravatar.com/avatar/08384a6869af55f5e3fef4ab6dd241abd7f63e7c7122db1072ab5048db900854?
s=60&d=retro&r=g)

### 󠀁[Una navaja suiza para ACF](https://wordpress.org/support/topic/una-navaja-suiza-para-acf/)󠁿

 [Jairo Ochoa](https://profiles.wordpress.org/jairoochoa/) 8 november 2021 1 svar

Si eres desarrollador y usas ACF este plugin es perfecto porque tienes todo el PHP
necesario con simplemente hacer copia pega. Aunque para campos de texto y otros 
quizás no sea necesario porque las funciones de ACF son sencillas de recordar, cuando
construyes estructuras más complejas con campos de repetición, por ejemplo, te ahorra
mucho tiempo. Lo copias, lo pegas en tu función de tu tema o plugin y ya puedes 
mostrar los datos en pantalla.

![](https://secure.gravatar.com/avatar/1dbe40a1a43b42f08111d4e832af50a0e2aac58960d162dd4932b45d770240fb?
s=60&d=retro&r=g)

### 󠀁[Great Plugin](https://wordpress.org/support/topic/great-plugin-32593/)󠁿

 [ensignrolaren](https://profiles.wordpress.org/ensignrolaren/) 8 november 2021 
1 svar

Big time saver.

 [ Läs alla 42 betyg ](https://wordpress.org/support/plugin/acf-theme-code/reviews/)

## Bidragsgivare och utvecklare

”ACF Theme Code for Advanced Custom Fields” är programvara med öppen källkod. Följande
personer har bidragit till detta tillägg.

Bidragande personer

 *   [ Aaron Rutley ](https://profiles.wordpress.org/aaronrutley/)
 *   [ Ben Pearson ](https://profiles.wordpress.org/benpearson/)
 *   [ Phil Kurth ](https://profiles.wordpress.org/philkurth/)

”ACF Theme Code for Advanced Custom Fields” har översatts till 9 språk. Tack till
[översättarna](https://translate.wordpress.org/projects/wp-plugins/acf-theme-code/contributors)
för deras bidrag.

[Översätt ”ACF Theme Code for Advanced Custom Fields” till ditt språk.](https://translate.wordpress.org/projects/wp-plugins/acf-theme-code)

### Intresserad av programutveckling?

[Läs programkoden](https://plugins.trac.wordpress.org/browser/acf-theme-code/), 
kika på [SVN-filförvaret](https://plugins.svn.wordpress.org/acf-theme-code/) eller
prenumerera på [utvecklarloggen](https://plugins.trac.wordpress.org/log/acf-theme-code/)
via [RSS](https://plugins.trac.wordpress.org/log/acf-theme-code/?limit=100&mode=stop_on_copy&format=rss).

## Ändringslogg

#### 2.5.6

 * Compatibility with WordPress 6.4

#### 2.5.5

 * Add new stylesheet to integrate all components with ACF 6
 * Update scroll to code functionality to support ACF 6

#### 2.5.4

 * Add support for ACF 6

#### 2.5.3

 * Add full support for localization (i18n)
    - Please let us know if you’re interested in helping translate ACF Theme Code
      into your language.

#### 2.5.2

 * Kompatibilitet med WordPress 5.8.0
 * Fix CSS and JS enqueue bugs

#### 2.5.0

 * Improve support for WordPress 5.4.
 * Improve support for all field types included in ACF PRO 5.8.9 (including all 
   their various settings).
 * Improve codebase by syncing both free and pro foundations to facilitate faster
   development cycles and future features.
 * Add escaping to code rendered to bring it in line with recent updates to ACF 
   field documentation. See https://twitter.com/wp_acf/status/1181344882775875584.
 * Add ’Copy All’ fields button (previously only Theme Code Pro feature).
 * Add various enhancements to code rendered for the following fields and field 
   settings:
    - Gallery field (return types Array, URL and ID)
    - Image (return types Array, URL and ID)
    - File (return types Array, URL and ID)
    - Select (values Single and Multiple, return types Value, Label and Array)
    - Checkbox (return types Value, Label and Array)
    - Radio Button (return type Array)
    - Button Group (return type Array)
    - Sant/falskt
    - Link (return types Array and URL)
    - Post Object (values Single and Multiple, return types Post Object and Post
      ID)
    - Page Link (values Single and Multiple)
    - Relationship (return types Post Object and Post ID)
    - Taxonomy (appearances Checkbox, Multi Select, Radio Buttons and Select, return
      types Term Object and Term ID)
    - User (values Single and Multiple, return types User Array, User Object and
      User ID)
    - Google Map
 * Add Location UI and move location related upgrade notice to code block
 * Fix issue with location related upgrade notice where it wouldn’t show if only
   Options location was selected.

#### 1.4.1

 * Kompatibilitet med WordPress 5.2.2

#### 1.4.0

 * All ACF v5 Free Fields Supported including: Group, Button, Range and Link fields.
 * Fix: Bug with locations section on PHP 7.2

#### 1.3.2

 * Fix: Updated clipboard.js & bug fix for the copy to clipboard feature

#### 1.3.1

 * Fix: Updates to array count functionality for PHP 5.4

#### 1.3.0

 * Core : Support for ACF Pro when bundled in a Theme
 * Fix : HTML output by the File field is now valid
 * Core : Notice for location rule support (now in ACF Theme Code Pro)

#### 1.2.0

 * Core: Quicklinks feature with anchor links to the relevant theme code block
 * Core: Notice updates & various bug fixes

#### 1.1.2

 * Fix: Use the_sub_field method for nested File fields with return format URL

#### 1.1.1

 * Field: Post Object field now works correctly for ACF 4
 * Core: Various internal code improvements

#### 1.1.0

 * Fields: All field formatting improved inline with ACF Theme Code Pro

#### 1.0.0

 * Core: First version

## Kommersiellt tillägg

Detta tillägg är gratis men erbjuder ytterligare betalda kommersiella uppgraderingar
eller support. [Visa support](https://hookturn.io/contact/)

## Meta

 *  Version **2.5.6**
 *  Senast uppdaterat **2 år sedan**
 *  Aktiva installationer **10 000+**
 *  WordPress-version ** 4.9.0 eller senare **
 *  Testat upp till **6.4.8**
 *  PHP-version ** 5.6 eller senare **
 *  Språk
 * [Dutch](https://nl.wordpress.org/plugins/acf-theme-code/), [Dutch (Belgium)](https://nl-be.wordpress.org/plugins/acf-theme-code/),
   [English (US)](https://wordpress.org/plugins/acf-theme-code/), [Japanese](https://ja.wordpress.org/plugins/acf-theme-code/),
   [Portuguese (Portugal)](https://pt.wordpress.org/plugins/acf-theme-code/), [Spanish (Chile)](https://cl.wordpress.org/plugins/acf-theme-code/),
   [Spanish (Mexico)](https://es-mx.wordpress.org/plugins/acf-theme-code/), [Spanish (Spain)](https://es.wordpress.org/plugins/acf-theme-code/),
   [Spanish (Venezuela)](https://ve.wordpress.org/plugins/acf-theme-code/) och [Swedish](https://sv.wordpress.org/plugins/acf-theme-code/).
 *  [Översätt till ditt språk](https://translate.wordpress.org/projects/wp-plugins/acf-theme-code)
 * Etiketter
 * [acf](https://sv.wordpress.org/plugins/tags/acf/)[advanced custom fields](https://sv.wordpress.org/plugins/tags/advanced-custom-fields/)
   [automation](https://sv.wordpress.org/plugins/tags/automation/)[php](https://sv.wordpress.org/plugins/tags/php/)
 *  [Avancerad vy](https://sv.wordpress.org/plugins/acf-theme-code/advanced/)

## Betyg

 5 av 5 stjärnor.

 *  [  41 5-stjärniga recensioner     ](https://wordpress.org/support/plugin/acf-theme-code/reviews/?filter=5)
 *  [  1 4-stjärnig recension     ](https://wordpress.org/support/plugin/acf-theme-code/reviews/?filter=4)
 *  [  0 3-stjärniga recensioner     ](https://wordpress.org/support/plugin/acf-theme-code/reviews/?filter=3)
 *  [  0 2-stjärniga recensioner     ](https://wordpress.org/support/plugin/acf-theme-code/reviews/?filter=2)
 *  [  0 1-stjärniga recensioner     ](https://wordpress.org/support/plugin/acf-theme-code/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/acf-theme-code/reviews/#new-post)

[Se alla recensioner](https://wordpress.org/support/plugin/acf-theme-code/reviews/)

## Bidragande personer

 *   [ Aaron Rutley ](https://profiles.wordpress.org/aaronrutley/)
 *   [ Ben Pearson ](https://profiles.wordpress.org/benpearson/)
 *   [ Phil Kurth ](https://profiles.wordpress.org/philkurth/)

## Support

Har du något att säga? Behöver du hjälp?

 [Visa supportforum](https://wordpress.org/support/plugin/acf-theme-code/)