Loading...

Shopping cart

DreamEditor is a powerful WordPress plugin designed to empower clients by granting them direct access to edit specific Advanced Custom Fields (ACF) on the frontend of their websites. With DreamEditor, clients can seamlessly make adjustments to key elements without the need to navigate through the backend, streamlining their workflow and enhancing their overall user experience. By offering this intuitive solution, DreamEditor simplifies the process of content management, putting control directly into the hands of clients and enabling them to effortlessly tailor their websites to meet their evolving needs and preferences.

 

Installation

Please ensure the Advanced Custom Fields plugin has been installed and activated on your website before continuing.

Your welcome email should contain a link to you account where you can download the latest version of Dream Editor. Alternatively, your Order Received page contains a link called “View API Downloads” where you can download the plugin. If you didn’t receive the email, or the download link isn’t working, then please contact help.

  • Download the latest version
  • Ensure the downloaded files are still in a zip file (sometimes these get unzipped).
  • Navigate to the “Add New Plugin” page on your website and click on “Upload Plugin” button at the top of the page.
  • Click on the “Choose file” button and select the dreameditor zip file.
  • Once uploaded click on “activate”
  • That’s it, DreamEditor has been installed.

Now DreamEditor is installed,you’ll need to include a fallback function in your theme. Simply open the functions.php file in your preferred text editor and copy-paste the provided code into it

if( ! function_exists('dreameditor_func') ) { function dreameditor_func( $callback ) { if( ! is_callable($callback) ) { return; } $args = array_slice(func_get_args(), 1); $value = call_user_func_array($callback, $args); return $value; } }

 

Activation

Before you can start using Dream Editor, we need to verify your installation. To do this, you need to enter a “Product order API Key” and the ”Product ID”. These can be found by visiting your account from the shop website (https://shop.twohourssleep.com/my-account).

  • From my account click on API Keys from the navigation sidebar.
  • On the API Keys page, location Dream Editor in the table and make a note of the API Key and Product ID.

If you do not see Dream Editor listed on the table, then please contact us.

Next we need to enter the data into your site.

  • From your WordPress admin dashboard,
  • Navigate to the settings tab, find “Dream Editor Activation” from the sub menu and click the link.
  • On the “API Key Activation” add your API key to the “API Key” field and the product ID to the “Product ID” field.
  • Click on save changes


If the credentials were verified your status will say “Activated” and there will be some additional information about your purchase. If this was unsuccessful, and your key/product ID are correct, then please contact us.

Getting Started

In this segment, we’ll guide you through seamlessly integrating DreamEditor into your theme. You have two options to achieve this:

Standard Parameter (string) – preferred

By specifying the ACF field’s name within the second parameter of the dreameditor_func() as a string.

Array Parameter (array)

For enhanced control and flexibility, you can assign an array of options as the second parameter (advanced). Below, you’ll find a list of arguments. Please note that “field_name” and “field_type” are mandatory fields. We’ve provided illustrative examples for each method in the fields section below.

Arguments for each field:

  • field_name*: This should mirror the name of your ACF field.
  • field_type*: Indicates the type of ACF field you intend to manage (e.g., text, wysiwyg, image).
  • field_path: This is used in nested fields such as groups, repeaters, and flexible content. More information about this is available in the Nested Fields section.
  • post_id: Define the ID of the field’s parent page/post/option.

*  Required

Fields

You’ll output the DreamEditor function to the parent element attributes of the Advanced Custom Fields (ACF) fields by using the ‘echo’ command. This allows you to seamlessly incorporate DreamEditor functionality into your basic fields, enhancing their capabilities effortlessly. The second parameter should mirror your ACF field name.

Text
Text area
Number
Email
URL
Link
Image
WYSIWYG
Text

The text field is a basic text input, its used to store small content strings.

Standard Parameter:

<h1 <?php echo dreameditor_func('dreameditor_field_args', 'main_title'); ?>><?php echo get_field('main_title') ?></h1>

Array Parameter:

<?php $content_editable_args = [ 'field_name' => 'main_title', 'field_type' => 'text', ]; ?> <h1 <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_field('main_title') ?></h1>
Text area
Number
Email
URL
Link
Image
WYSIWYG

Nested Content

You’ll render the DreamEditor function into the parent element attributes of the Advanced Custom Fields (ACF) fields using the ‘echo’ command, similar to the fields above. However, ensure you’re utilizing a while loop for these fields. Examples of these are provided below. If you opt to use the optional argument array (advanced), please refer to the information provided below.

These instructions are necessary only if you’re utilising an array argument (advanced).

Nested content fields require an additional option to configure in the array structure, known as “field_path.” This option proves particularly useful for fields containing additional nested fields within their structure. To determine the path name, start with the name of your primary field. For example, if your primary field is named ‘main_group,’ your path would be ‘main_group.’ However, if your primary field is either a Repeater or Flexible Content, we need to consider the iteration we intend to edit. To accomplish this, we create a counter for the while loop and append it to the end of the path. For instance, ‘main_repeater_0’ would target the first iteration in your loop.

It’s crucial to account for any fields nested within groups or repeaters. For instance, if you have a repeater containing a group, this nesting should be reflected in the field path. To achieve this, append the name of each nested field to your path. For example, ‘main_repeater_0_group_name’ would correctly identify a field within the nested structure.

Groups
Repeaters
Flexible Content
Groups

The Group field uses both the parent and child field names when saving and loading values. For example, a Group field named ‘hero’ with a sub field named ‘image’ will be saved to the database using the meta name ‘hero_image’.

Standard Parameter:

<?php if( have_rows('group_name') ) : while( have_rows('group_name') ) : the_row(); ?> <h1 <?php echo dreameditor_func('dreameditor_field_args', 'main_title'); ?>><?php echo get_sub_field('main_title'); ?></h1> <?php endwhile; endif; ?>

Array Parameter:

<?php if( have_rows('group_name') ) : while( have_rows('group_name') ) : the_row(); ?> <?php $content_editable_args = [ 'field_name' => 'main_title', 'field_type' => 'text', 'field_path' => 'group_name' ]; ?> <h1 <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_sub_field('main_title'); ?></h1> <?php endwhile; endif; ?>
Repeaters
Flexible Content

Changlog

{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}