Tel: +44 (0) 1892249038
Shopping cart
Quick Nav
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
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
The text area field is useful to store simple (i.e., unstyled) paragraphs of text to use in your theme.
Standard Parameter:
<p <?php echo dreameditor_func('dreameditor_field_args', 'basic_content'); ?>><?php echo get_field('basic_content'); ?></p>
Array Parameter:
<?php $content_editable_args = array( 'field_name' => 'basic_content', 'field_type' => 'text_area', ); ?> <p <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_field('basic_content'); ?></p>
Number
The Number field stores an input limited to numerical values.
Standard Parameter:
<span <?php echo dreameditor_func('dreameditor_field_args', 'arbitary_number'); ?>><?php echo get_field('arbitary_number'); ?></span>
Array Parameter:
<?php $content_editable_args = array( 'field_name' => 'arbitary_number', 'field_type' => 'number', ); ?> <span <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_field('arbitary_number'); ?></span>
The Email field is used for storing email address values.
Standard Parameter:
<span <?php echo dreameditor_func('dreameditor_field_args', 'email_address'); ?>><?php echo get_field('email_address'); ?></span>
Array Parameter:
<?php $content_editable_args = array( 'field_name' => 'email_address', 'field_type' => 'email', ); ?> <span <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_field('email_address'); ?></span>
URL
The URL field is a text input specifically designed for storing web addresses.
Standard Parameter:
<span <?php echo dreameditor_func('dreameditor_field_args', 'website'); ?>><?php echo get_field('website'); ?></span>
Array Parameter:
<?php $content_editable_args = array( 'field_name' => 'website', 'field_type' => 'url', ); ?> <span <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_field('website'); ?></span>
Link
The Link field allows a link to be selected or defined (url, title, target).
Standard Parameter:
<?php $call_to_action = get_field('call_to_action'); ?> <a <?php echo dreameditor_func('dreameditor_field_args', 'call_to_action'); ?> href="<?php echo isset($call_to_action['url']) ? $call_to_action['url'] : ''; ?>"> <?php echo isset($call_to_action['title']) ? $call_to_action['title'] : ''; ?> </a>
Array Parameter:
<?php $content_editable_args = array( 'field_name' => 'call_to_action', 'field_type' => 'link', ); $call_to_action = get_field('call_to_action'); ?> <a <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?> href="<?php echo isset($call_to_action['url']) ? $call_to_action['url'] : ''; ?>"> <?php echo isset($call_to_action['title']) ? $call_to_action['title'] : ''; ?> </a>
Image
The Image field allows an image to be uploaded and selected by using the native WordPress media modal.
Standard Parameter:
<?php $main_image = get_field('main_image'); ?> <img <?php echo dreameditor_func('dreameditor_field_args', 'main_image'); ?> src="<?php echo isset($main_image['sizes']['large']) ? $main_image['sizes']['large'] : ''; ?>" alt="<?php echo isset($main_image['alt']) ? $main_image['alt'] : ''; ?>">
Array Parameter:
<?php $content_editable_args = array( 'field_name' => 'main_image', 'field_type' => 'image', ); $main_image = get_field('main_image'); ?> <img <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?> src="<?php echo isset($main_image['sizes']['large']) ? $main_image['sizes']['large'] : ''; ?>" alt="<?php echo isset($main_image['alt']) ? $main_image['alt'] : ''; ?>">
WYSIWYG
The Wysiwyg field creates a WordPress content editor as seen in Posts and Pages. Wysiwyg is an acronym for “what you see is what you get”.
This is one of the most useful fields for editing content as it allows for both text and multimedia to be edited and styled within a single area.
Standard Parameter:
<div <?php echo dreameditor_func('dreameditor_field_args', 'main_content'); ?>> <?php echo get_field('main_content'); ?> </div>
Array Parameter:
<?php $content_editable_args = array( 'field_name' => 'main_content', 'field_type' => 'wysiwyg', ); ?> <div <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>> <?php echo get_field('main_content'); ?> </div>
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
This field type acts as a parent to a set of sub fields which can be repeated again and again. What makes this field type so special is its versatility. Any kind of field can be used within a Repeater, and there are no limits to the number of repeats either.
Standard Parameter:
<?php if( have_rows('repeater_name') ) : $index = 0; while( have_rows('repeater_name') ) : the_row(); ?> <h1 <?php echo dreameditor_func('dreameditor_field_args', 'main_title'); ?>><?php echo get_sub_field('main_title'); ?></h1> <?php $index++; endwhile; endif; ?>
Array Parameter:
<?php if( have_rows('repeater_name') ) : $index = 0; while( have_rows('repeater_name') ) : the_row(); $content_editable_args = [ 'field_name' => 'main_title', 'field_type' => 'text', 'field_path' => sprintf('repeater_name_%s', $index) ]; ?> <h1 <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_sub_field('main_title'); ?></h1> <?php $index++; endwhile; endif; ?>
Flexible Content
The Flexible Content field provides a simple, structured, block-based editor.
Using layouts and sub fields to design the available blocks, this field type acts as a blank canvas to which you can define, create and manage content with total control.
Standard Parameter:
<?php if( have_rows('flexible_content_name') ) : $index = 0; while( have_rows('flexible_content_name') ) : the_row(); if( get_row_layout() === 'hero' ) : ?> <h1 <?php echo dreameditor_func('dreameditor_field_args', 'main_title'); ?>><?php echo get_sub_field('main_title'); ?></h1> <?php endif; $index++; endwhile; endif; ?>
Array Parameter:
<?php if( have_rows('flexible_content_name') ) : $index = 0; while( have_rows('flexible_content_name') ) : the_row(); if( get_row_layout() === 'hero' ) : $content_editable_args = [ 'field_name' => 'main_title', 'field_type' => 'text', 'field_path' => sprintf('flexible_content_name_%s', $index) ]; ?> <h1 <?php echo dreameditor_func('dreameditor_field_args',$content_editable_args); ?>><?php echo get_sub_field('main_title'); ?></h1> <?php endif; $index++; endwhile; endif; ?>
Changlog
Demo
Site details:
User: demo
Password: d6f841559c20
WordPress login:
User:demo
Password:fAn(bw3jx4fMyr0Hxrc5PUNH
Note: You use the THS DreamEditor, please login with the detail above.�
URL:https://dreamtheme1.wpengine.com
Admin URL:https://dreamtheme1.wpengine.com/wp-admin
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
Cookie key | Domain | Path | Cookie type | Expiration | Description |
---|---|---|---|---|---|
__cf_bm | .brevo.com | / | Third-party | 30 minutes | This cookie is used to distinguish between humans and bots. This is beneficial for the website, in order to make valid reports on the use of their website. |
AWSALBCORS | conversations-widget.brevo.com | / | Third-party | 7 days | For continued stickiness support with CORS use cases after the Chromium update, we are creating additional stickiness cookies for each of these duration-based stickiness features named AWSALBCORS (ALB). |
__cf_bm | .vimeo.com | / | Third-party | 30 minutes | This cookie is used to distinguish between humans and bots. This is beneficial for the website, in order to make valid reports on the use of their website. |
nitroCachedPage | www.twohourssleep.com | / | Third-party | Session | This cookie sets the cached status of the viewed page. This speeds up page delivery. |
tweolvc8 | www.twohourssleep.com | / | First-party | 5 days | Plugin |
903ezqhg | www.twohourssleep.com | / | First-party | 5 days | Plugin |
sib_cuid | www.twohourssleep.com | / | First-party | 6 months 1 day | Plugin |
uuid | sibautomation.com | /cm.html?key=hvb7jsusa77rbuhpmy1sv3j0 | Third-party | Varies | Used for tracking and automation purposes. |
Storages
Storage key | Type | Category |
---|---|---|
bot_detector_screen_info | local | Strictly Necessary |
bot_detector_event_token | local | Strictly Necessary |
bot_detector_page_hits | local | Strictly Necessary |
bot_detector_user_agent | local | Strictly Necessary |
bot_detector_headless | local | Strictly Necessary |
bot_detector_referrer | local | Strictly Necessary |
bot_detector_referrer_previous | local | Strictly Necessary |
bot_detector_mouse_moved | local | Strictly Necessary |
bot_detector_pointer_data | local | Strictly Necessary |
bot_detector_browser_supports_cookies | local | Strictly Necessary |
bot_detector_has_scrolled | local | Strictly Necessary |
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
This website uses the following additional cookies:
Cookie key | Domain | Path | Cookie type | Expiration | Description |
---|---|---|---|---|---|
_ga_PVM764X7D0 | .twohourssleep.com | / | First-party | 1 year 1 month | This cookie is used by Google Analytics to persist session state. |
_ga | .twohourssleep.com | / | First-party | 1 year 1 month | This cookie name is associated with Google Universal Analytics - which is a significant update to Google's more commonly used analytics service. This cookie is used to distinguish unique users by assigning a randomly generated number as a client identifier. It is included in each page request in a site and used to calculate visitor, session and campaign data for the sites analytics reports. |
test_cookie | .doubleclick.net | / | Third-party | 15 minutes | This cookie is set by DoubleClick (which is owned by Google) to determine if the website visitor's browser supports cookies. |
uuid | sibautomation.com | / | Third-party | 6 months 1 day | This cookie is used to optimize ad relevance by collecting visitor data from multiple websites – this exchange of visitor data is normally provided by a third-party data-center or ad-exchange. |
_gcl_au | .twohourssleep.com | / | First-party | 3 months | Used by Google AdSense for experimenting with advertisement efficiency across websites using their services |
Please enable Strictly Necessary Cookies first so that we can save your preferences!
More information about our Cookie Policy