Giter Club home page Giter Club logo

acf-field-type-template's Introduction

ACF { Field Type Template

Welcome to the repository for Advanced Custom Fields Field Type Template. This repository holds a starting kit to create a field type Add-on with these abilities:

  • works in ACF version 4
  • works in ACF version 3
  • works as a WP plugin
  • works as a themem include

For more information,please read the documentation here: http://www.advancedcustomfields.com/resources/tutorials/creating-a-new-field-type/

Structure

  • /css : folder for .css files.
  • /images : folder for image files
  • /js : folder for .js files
  • /lang : folder for .po and .mo files
  • acf-{{field_name}}.php : Main add-on file. This file acts as the WP plugin and includes the neccessary field file
  • {{field_name}}-v4.php : Field class compatible with ACF version 4
  • {{field_name}}-v3.php : Field class compatible with ACF version 3
  • readme.txt : WordPress readme file to be used by the wordpress repository if this addon is also uploaded to WP

step 1.

This template uses moustache placeholders such as this {{field_name}} throughout the file names and code. Use the list of placeholders below to do a 'find and replace'. The list below shows an example for a field called 'Google Maps'

General

  • {{field_name}} : google_maps (used for class & file names so please use '_' instead of '-')
  • {{field_label}} : Google Maps

Readme

step 2.

Edit the {{field_name}}-v4.php and {{field_name}}-v3.php files (now renamed with your field name) and include your custom code in the apropriate functions. Please note that v3 and v4 field classes have slightly different functions. For more information, please read:

step 3.

Edit this README.md file with the apropriate information and delete all content above and including the following line!


ACF { {{field_label}} Field

Adds a '{{field_label}}' field type for the Advanced Custom Fields WordPress plugin.


Overview

{{description}}

Compatibility

This add-on will work with:

  • version 4 and up
  • version 3 and bellow

Installation

This add-on can be treated as both a WP plugin and a theme include.

Install as Plugin

  1. Copy the 'acf-{{field_name}}' folder into your plugins folder
  2. Activate the plugin via the Plugins admin page

Include within theme

  1. Copy the 'acf-{{field_name}}' folder into your theme folder (can use sub folders). You can place the folder anywhere inside the 'wp-content' directory
  2. Edit your functions.php file and add the code below (Make sure the path is correct to include the acf-{{field_name}}.php file)
add_action('acf/register_fields', 'my_register_fields');

function my_register_fields()
{
	include_once('acf-{{field_name}}/acf-{{field_name}}.php');
}

More Information

Please read the readme.txt file for more information

acf-field-type-template's People

Contributors

elliotcondon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.