How to use sample


Installation of sample template

  1. Copy the “sample” folder set in the “Editor Template Files” plug-in folder.

Sample template folder location:
/wp-content/plugins/editor-template-files/sample/〜

  1. Move the copied sample folder into the template folder you are using.

Move to:
/wp-content/themes/Your Theme Folder/sample/〜

※ Please be directly under the template folder.

  1. Change the folder name of the moved sample folder to “editor-template-files”.

Sample:
/wp-content/themes/Your Theme Folder/editor-template-files/〜

Now you can use it.

If you want to experience the editor style and value replacement, please also set the following.


  1. Set the editor style for the sample template.
    Add the following code to functions.php in the theme folder.

add_editor_style( 'custom-editor-style.css' );

※ If you have already set the editor style, it may break styles.
After confirming the sample, we recommend that you cancel the setting.

  1. Make settings to confirm the sample of “Value Replacement”. Add the following code to functions.php in the theme folder.
add_filter('etf_tpl_values', 'hoge');

function hoge( $values ) {
	global $post_id;

	$values['sample_value'] = 'Editor Template FilesSample Page !!';
	$values['date'] = get_the_time( 'Y-m-d', $post_id );
	$values['etf_plugin_autor'] = 'hana';

	return $values;
}​

Thank you for your hard work!
This is the end of the sample settings.


How to use sample templates

After completing the settings above, check it from the management screen.

  1. From the WordPress management screen, open the post page with the TInyMCE editor such as posts. From the WordPress management screen, open the post page with the TInyMCE editor such as posts.

  2. Open the template dialog.

From Insert > Template From Insert > Template From the template button From the template button

  1. Templates installed on the selection screen can be selected. Templates installed on the selection screen can be selected.

  2. First, select “Sample Template”.

  3. Insert the template with “ok”. Insert the template with ok.

  4. The template has been inserted! The template has been inserted!

Confirmation of non-editable / editable areas

Let’s check the part that is set as not editable / editable.

  1. Follow the image below and click to edit. Follow the image below and click to edit.

Cannot edit.
This is because it is set to non-editable.

  1. Follow the image below and click to edit. Follow the image below and click to edit.

An edit button has appeared.
Here, the box surrounding the image is set to be editable, so you can edit within the box. Here, the box surrounding the image is set to be editable, so you can edit within the box.

  1. Check the following: Check the following:

The link edit button is ready.
Here, the edit setting is set to the a tag, so you can confirm that only the link setting can be edited.

Confirm “Replace Value”

  1. The following preview was confirmed on the template selection screen. The following preview was confirmed on the template selection screen.

The links in {$ sample_value} and images are also broken.

  1. If you insert the template with “ok”, you can see that it is displayed. If you insert the template with ok, you can see that it is displayed.

This is because it has been replaced with the preset value and inserted.

  1. Let’s look at the replaced parts.
    It has changed to the value set in functions.php in sample installation 5.
add_filter('etf_tpl_values', 'hoge');
function hoge( $values ) {
	global $post_id;

	$values['sample_value'] = 'Editor Template FilesSample Page !!';
	$values['date'] = get_the_time( 'Y-m-d', $post_id );

	$values['etf_plugin_autor'] = 'hana';

	return $values;
}

In template

{$sample_value}

The value of {$ sample_value} in the template has been replaced with Editor Template Files <br> Sample Page !!.

※ functions.php
It is set by
$values['sample_value'] = 'Editor Template FilesSample Page !!';.

{$date}

“Post creation date” is entered.
For new posts, the current date.
If it has already been saved, it contains the article creation date.

※ functions.php
It is set by
$values['date'] = get_the_time( 'Y-m-d', $post_id );​.

get_the_time () is a template tag of wordpress.
By setting the template tag etc. in this way, it becomes possible to change the value depending on the article when reading the template.