How to Use it as a Part of Your Plugin or Theme
One of the useful features of my Simple Fields plugin is that you can easily make it a part of your custom WordPress plugin or a theme. But don’t forget that if you’re going to use this custom plugin or theme on multiple websites, developer license is required.
So, it can be done easily with three steps:
- Copy the content of
assetsandincludesfolders into your custom plugin, - Include
init.phpfile, - Update the URLs in
wp_register_style()andwp_register_script()functions (optional – it is only needed if you’re going to use some specific fields).
Now let’s take a step-by-step look into this process.
1. Copying “assets” and “includes” directories
Let’s assume that you’re developing a custom WordPress theme. Then after copying assets and includes directories, your theme structure may look like this:

Feel free to rename these directories if you need to.
2. Including init.php file
Since we’re creating a theme, let’s open its functions.php file and add the following line there:
require_once( __DIR__ . '/includes/init.php' );In case you renamed the includes directory, don’t forget about it here as well.
3. Registering plugin styles and scripts
The assets folder consists of 3 files:
main.cssandmain.js– for Image, Gallery, File, Repeater and Multiselect fields and conditional logic.sidebar.js– for sidebars in the Block Editor.
For example let’s say that we’re not going to use fields in Gutenberg, in that case we need to only register main.js and main.css and we can do it by using the following code in our theme functions.php file:
add_action( 'admin_enqueue_scripts', function() {
wp_register_style( 'sf_css', get_stylesheet_directory_uri() . '/assets/main.css' );
wp_register_script(
'sf_js',
get_stylesheet_directory_uri() . '/assets/main.js',
array( 'jquery' )
);
} );You can also find an example of this snippet in rudr-simple-fields.php file.
That’s pretty much it, now you can create fields!