How to create your own document templates. Creating templates How to make templates on a computer

If you often work in MS Word, saving a document as a template will probably interest you. So, having a template file with formatting, fields and other parameters that you set can greatly simplify and speed up the workflow.

A template created in Word is saved in DOT, DOTX or DOTM formats. The latter allows working with macros.

Sample is a special type of document; when it is opened and subsequently modified, a copy of the file is created. The original (template) document remains unchanged, as does its location on the disk.

As an example of what a document template can be and why it is needed at all, you can give a business plan. Documents of this type are quite often created in Word, therefore, they are also used quite often.

So, instead of re-creating the document structure each time, choosing appropriate fonts, design styles, and setting margin sizes, you can simply use a template with a standard layout. Agree, this approach to work is much more rational.

A document saved as a template can be opened and filled in with the necessary data and text. At the same time, keeping it in standard for Word formats DOC and DOCX, the original document (the created template) will remain unchanged as mentioned above.

Most of the templates that you may need to work with documents in Word can be found on the official website (). In addition, you can create your own templates in the program, as well as modify existing ones.

Note: Some of the templates are already built into the program, but some of them, although displayed in the list, are actually located on the Office.com website. After you click on such a template, it will be instantly downloaded from the site and available for use.

Create your own template

The easiest way to start creating a template is with a blank document, which you can open by simply launching Word.

If you are using one of the latest versions of MS Word, when you open the program you will be greeted with start page, where you can select one of the available templates. What’s especially pleasing is that they are all conveniently sorted into thematic categories.

However, if you want to create a template yourself, choose "New document". A standard document will open with its default settings. These parameters can be either software ( specified by developers), and those created by you (if you previously saved certain values ​​as default ones).

Using our lessons, make the necessary changes to the document, which will later be used as a template.

In addition to performing the above steps, you can also add a watermark, watermarks, or any graphics as default settings for the document to be used as a template. Everything you change, add and save in the future will be present in every document created based on your template.

Lessons on working with Word:
Inserting a picture
Adding a matte
Changing the background in a document
Creating flowcharts
Inserting characters and special characters

After you make the necessary changes, set default parameters to the future template, you need to save it.

1. Click the button "File"(or "MS Office", if you use old version Word).

3. In the drop down menu "File type" select the appropriate template type:

  • Word template (*.dotx): a regular template, compatible with all versions of Word older than 2003;
  • Word template with macro support (*.dotm): as the name suggests, this type templates support working with macros;
  • Template Word 97 - 2003 (*.dot): compatible with older versions of Word 1997 - 2003.

4. Set the file name, specify the path to save it and click "Save".

5. The file you created and configured will be saved as a template in the format you specified. Now you can close it.

Create a template from an existing document or a standard template

1. Open a blank MS Word document, go to the tab "File" and select "Create".

Note: IN latest versions In Word, when opening an empty document, the user is immediately offered a list of template layouts on the basis of which a future document can be created. If you want to access all templates, select when opening "New document", and then follow the steps described in point 1.

2. Select the appropriate template in the section “Available templates”.

Note: In recent versions of Word you don’t need to select anything, the list of available templates appears immediately after clicking the button "Create", directly above the templates there is a list of available categories.

3. Make the necessary changes to the document using our tips and instructions presented in the previous section of the article (Creating your own template).

Note: For different templates, text styles that are available by default and presented in the tab "Home" in Group “Styles”, may be different and noticeably different from those that you are used to seeing in a standard document.

    Advice: Take advantage of the available styles to make your future template truly unique, unlike other documents. Of course, do this only if you are not limited by the document requirements.

4. After you make the necessary changes to the document, make all the settings that you consider necessary, save the file. To do this, click on the tab "File" and select "Save as".

5. In section "File type" select the appropriate template type.

6. Set a name for the template, specify via "Conductor" ("Review") path to save it, click the button "Save".

7. The template you create based on the existing one will be saved along with any changes you made. This file can now be closed.

Adding Building Blocks to a Template

Building blocks are the reusable elements contained in a document, as well as those document components that are stored in a collection and available for use at any time. You can store and distribute building blocks using templates.

So, using standard blocks, you can create a report template that will contain cover letters of two or more types. At the same time, when creating a new report based on this template, other users will be able to select any of the available types.

1. Create, save and close the template you created taking into account all the requirements. It is to this file that standard blocks will be added, which will later be available to other users of the template you created.

2. Open the template document to which you want to add building blocks.

3. Create the necessary building blocks, which will later be available to other users.

Note: When entering information in the dialog box “Creating a new building block” enter in the line “Save to” the name of the template to which they need to be added (this is the file that you created, saved and closed according to the first paragraph of this section of the article).

The template you created, containing the building blocks, can now be shared with other users. The blocks themselves, saved with it, will be available in the specified collections.

Adding Content Controls to a Template

There are some situations where you want to give your template and all of its contents some flexibility. For example, a template might contain a drop-down list created by the author. For one reason or another, this list may not suit another user who happens to work with it.

If such a template contains content controls, the second user will be able to adjust the list to suit themselves, leaving it unchanged in the template itself. To add content controls to your template, you must enable the tab “Developer” in MS Word.

1. Open the menu "File"(or "MS Office" in earlier versions of the program).

2. Open the section "Options" and select the item there “Customize the Ribbon”.

3. In the section “Main Tabs” check the box next to the item “Developer”. To close the window, click "OK".

4. Tab “Developer” will appear on the Word control panel.

Adding Content Controls

1. In the tab “Developer” click on the button “Design mode” located in the group “Controls”.

Insert the necessary controls into the document by selecting them from those presented in the group of the same name:

  • Rich text;
  • Plain text;
  • Drawing;
  • Collection of building blocks;
  • Combo box;
  • Drop-down list;
  • Date selection;
  • Checkbox;
  • Repeating section.

Add explanatory text to a template

You can make the template more user-friendly by adding explanatory text to the document. If necessary, the default explanatory text can always be changed in the content control. To set the default explanatory text for users who will use the template, follow these steps:

1. Turn on “Design mode”(tab “Developer”, group “Controls”).

2. Click the content control where you want to add or change explanatory text.

Note: Explanatory text is in small blocks by default. If “Design mode” disabled, these blocks are not displayed.

3. Change, format the alt text.

4. Disable “Design mode” by pressing this button on the control panel again.

5. Explanatory text will be saved for the current template.

We'll finish here, from this article you learned about what templates are in Microsoft Word, how to create and change them, as well as everything that you can do with them. It's really useful feature a program that greatly simplifies working with it, especially if not one, but several users are working on documents at once, not to mention large companies.

Creating a WordPress template is easier than you might think. To do this, you do not need to have extensive experience in website design or programming. In this article, we'll walk you through the basics of creating your own WordPress themes from scratch.

Why would you even need to create your own? WordPress template When can I use the blanks available in the database? Here are some reasons that may prompt this:

  • You can get a unique website or landing page that is different from your competitors. Considering the millions of blogs built on this CMS, each standard design is used at least a hundred times.
  • Complete freedom of action at the development stage. You can add your own functionality with the work elements you need.
  • You can use different designs for different sections of the site, which is not possible when using a ready-made template.
  • You can create multiple views and give visitors the ability to switch between different topics, which will increase interest and loyalty to the web resource.
  • The simplicity of working on WordPress makes it accessible to many (video tutorials on the Internet will help). This means that developing a main theme or creating a child theme yourself will save money on hiring third-party designers and programmers.
  • You can take advantage of the possibility of child themes - when adjustments are made to duplicate style sheets style.css, while the main file remains untouched. This allows you to quickly undo changes if they are unsuccessful, and also not to lose work when updating the main theme.

Brief instructions

Of course, you won’t be able to fully learn how to create a page template with just one article. To begin with, it is important to understand the basics - how the simplest themes are made. Based on them, you can already get creative and create a landing page or website according to your desires. Now we will give you a short cheat sheet with step-by-step instructions - it will help you understand how to create a website.

Step one: preparatory work

Before starting work, you need to make sure that you have a text editor (the simplest is Notepad or Nodepad++, especially since you can download them for free). The next step is to install the WordPress engine and Denwer kit on local computer. Denver is a package of essential tools for programmers. With their help, the process of developing and modifying websites is greatly facilitated and accelerated. This video will show you how to install it:

Step two: create a new theme folder

Let's go to the desired directory. It most often takes the following path: . All themes are stored here - both standard and custom. Let's go into it and create it new folder. We call it, for example, “MyFirstTheme”.

Now go to a new folder and be sure to add two files made through Nodepad++ or another editor. These are index.php and style.css. For now, let these documents remain empty, then we will start filling them out. Also add the images folder to “MyFirstTheme”. where you can add pictures to decorate the template.

Subsequently, you can add templates to “MyFirstTheme” for individual parts of the site: sidebar (sidebar.php), site (header.php), posts on pages (single.php), comments (comments.php), etc. A set of additional files depends on the structure you plan for your web resource.

Step three: filling index.php

The first thing to do is fill out the index file (index.php). Here is an example of the simple code, according to which the site will have four areas: header, main, sidebar and footer.














In the file you can register any elements that you want to see on your website. More information about writing index.php code to create themes in WordPress can be found in the video:

Step four: fill in style.css

Now you need to open style.css, add and fill in the following fields (enter your own information about the site and owner instead of ***). The entered data will be displayed in the admin panel.

/*Theme Name: ***

Theme URI: http:// ***

Author URI: http:// ***

Description: ***

Subsequently, it will be possible to enter various data and rules into this file that determine the appearance of the pages. For example:

(the information in /**/ is comments, not parts of code)

At this stage, it is too early to set strict style parameters, but when further working with the file, this video tutorial will be useful:

Step five: split the files

All elements specified in index.php should be duplicated in separate files. In step one, in the example, in addition to the main part, header, sidebar and footer were specified - therefore, we create our own documents for them in .php format.

For example, create a file header.php, open index.php. find the corresponding section of code and paste it into new file. It will be:






Site Title



The same is done for the remaining parts. This should be done for easier navigation. When there are many elements of the future site, then separate files will help you better navigate for checking or making changes.
In order for the main index file to be consistent with the additional ones, the following must be written in index.php under the blocks for each part:






Below is a list of standard template files used by WordPress. You don’t have to use them or add your own sections:

  • Header – the style of your site’s header.
  • Comments – template for creating comments.
  • Home – theme for the main page.
  • Page - defines the theme if you create separate pages on the site
  • Category – template for breaking down categories
  • Date – defines the date-time display style.
  • Archive – a template for an archive section with old materials.
  • Search – a file that specifies parameters for searching on the site.
  • 404 is a template for a page that reports a 404 Not Found error.
  • Footer – defines the style of your site's footer.

When you subsequently refine each element, you will need a visual video tutorial. Here are a few selections that may help you:

Header in header.php:

Adding content:

Styling comments:

Footer on the site:

How to make changes safely

When you need to make changes to website pages, there is a risk of writing something incorrectly and not being able to “roll back” it. It may also happen that stylesheet entries disappear when the main theme is updated.

To prevent this from happening, you can create a child WordPress theme (subtheme) - this is a duplicate of the style.css file that does not affect the main file (changes in one do not cancel updates in the other).

Creating a WordPress child theme is easy. You need to make a new folder in the main directory C:\WebServers\home\localhost\www\NAME_SET_DUR_INSTALL\wp-content\themes. In the new folder we create our own style.css file with the following content:

Theme Name: TOPIC NAME

Template: FOLDER NAME IN CHILD THEME

Theme URI: FILL IN

Description: FILL IN

Author URI: FILL IN

/* import the styles of the parent theme */

@import url("../NAME/style.css");

/* Your own additional styles */

Foo( color:red; )

Now you can go to “Appearance›Themes” in the admin panel and activate the child template. In the future, you can work in the new file. In addition, a short video presentation on the topic of child templates:

In this article, I will talk about ways to create templates for WordPress persistent pages. Each method has its pros and cons. But before we begin, a little about what pages are and how they differ from posts.

In WordPress you can create pages (pages) and posts (posts). They differ in that the entries: end up in the feed on home page; Categories are indicated for entries; posts cannot be tree-like, and pages: are used for content such as “About me”, “Contacts”, “Site map”; do not have categories, but have a tree structure. Entries are usually intended for chronological information (based on the time they were added), and pages are for a tree structure that is independent of time. For example, this article is published as an “entry” in the “Code” section, and links in the header menu lead to the pages: Functions.

Pages are similar to records - they are located in the same database table and their data is almost the same: title, text, additional fields, etc. Both are records, but different types: Pages are tree-like and organized by creating parent and child pages, and posts are organized by categories and tags. In WordPress you can create additional post types, tree or not.

Creating Pages in WordPress

Often you need to create a separate page template so that the information displayed differs from other pages. By creating a page template in WordPress, you can completely change the page: remove the sidebar, footer, header, you can change the page beyond recognition. For example, on this site the page on which the WordPress file codes are displayed is changed in this way.

Method 1: page template using a file with a custom name and connecting it in the admin panel (classic method)

This is the most common way to create a page template in WordPress. To do this, you need to create a .php file, for example, tpl_my-page.php in the theme folder and at the very beginning of the file write a note that the created file is a template for pages:

Now, when creating a page in the admin panel, in the “Page Properties” block, we can select a “template”:

From WordPress 4.7. Such page templates can be created for any type of post, not just page. To do this, supplement the comments with the line: Template Post Type: post, page, where post, page are the names of the post types to which the template belongs.

/* Template Name: My page template Template Post Type: post, page, product */

Advantages:

    Having created one template, we can conveniently apply it to different pages. For example, you can create a template without a sidebar and use it on different pages.

  • Only records with the specified template can be retrieved. For example, you can display all pages with the “Services” template (servises.php file). Sometimes it's convenient. The name of the template file is stored in the _wp_page_template metafield, so to display pages with the specified template you need to create a query using the metafield (see WP_Query).

Flaws:

After creating the template file in the theme folder, you need to go to the admin panel and install the template for the page. This is not always convenient during development. Therefore, if you intend to use the template for only one page, use the second method.

How it works:

When you go to the admin panel to edit a tree post page, WordPress scans all template files for the line:

Template Name: ***

The line can be located anywhere and any way in the file.

All files with similar strings are collected and displayed in the template selection in the "Page Attributes" block.

When publishing a page, the custom field _wp_page_template is filled with the name of the template file or default if no template is specified:

Wp_page_template = default
_wp_page_template = tpl_my-page.php

Next, when the user visits the page, WordPress will check the _wp_page_template meta field, if the template is installed, then the template file is used. Otherwise, the search for the page template continues through the hierarchy.

Method 2: page template via a file with a specific name (hierarchy of template files)

When a page is created, a label (slug, alternative name). It is used in the page URL. And it can be changed:


To create a template this way, you need to find out the page slug and create a file in the theme folder. Let’s say our slug, as in the picture, is equal to contacts , then we’ll create a page-contacts.php file in the theme. and fill it out the required code(you can copy the contents from the page.php template file and edit it to your liking). That's it, now when we visit the page we should see new template. Similarly, you can take the ID (let it be 12) of the page and create a file page-12.php .

Advantages:

There is no need to go to the admin panel and install the template file. The template starts working immediately after the file is created. Convenient for development.

Flaws:

The template is created only for one specific page. Depends on the slug of the page; if it changes, the template will not work. If you use ID, then the dependence on the slug disappears, but it becomes unclear in the theme file which page the template belongs to (if there are several templates with ID).

Almost useless when writing templates, and even more so plugins. It can be used when you edit your website, in which the slug or page ID is known in advance.

How it works:

WordPeress selects which file to use in the following order (the files must be in the theme root):

  • (any_name).php (when using a page template)
  • page-(post_label).php
  • page-(post_ID).php
  • page.php
  • singular.php
  • index.php

Method 3: page template through the "template_include" filter (coding)

This is an advanced method, it is more complex, but along with the complexity it opens up wide possibilities. Using this method, you can set a template for any page, post, category, any publication on the site, or even a group of any publications. See examples with descriptions:

// the filter passes the $template variable - the path to the template file. // By changing this path we change the template file. add_filter("template_include", "my_template"); function my_template($template) ( # similar to the second method // if this is a page with the portfolio slug, use the template file page-portfolio.php // use the conditional tag is_page() if(is_page("portfolio"))( if ($new_template = locate_template(array("page-portfolio.php"))) return $new_template ; ) # template for category group // this example will use the file from the theme folder tpl_special-cats.php, // as a template for categories with ID 9 , title "Uncategorized" and slug "php" if(is_category(array(9, "Uncategorized", "php")))( return get_stylesheet_directory() . "/tpl_special-cats.php"; ) # template for entry by ID // the template file is located in the plugin folder /my-plugin/site-template.php global $post; if($post->ID == 12)( return wp_normalize_path(WP_PLUGIN_DIR) . "/my-plugin/site- template.php"; ) # template for pages of a custom type "book" // it is assumed that the template file book-tpl.php is in the theme folder global $post; if($post->post_type == "book")( return get_stylesheet_directory() . "/book-tpl.php"; ) return $template; )

This code needs to be placed in the theme’s functions.php file or in a plugin, or connected in some other way. As you can see from the example, during the template_include filter, conditional tags are already working, global variables are set: $wp_query , $post , etc.

Advantages:

    You can set a template for any page or group of pages. Almost complete carte blanche in actions.

  • You can create a template when writing a plugin.

Flaws:

The need to write code and connect it separately (for example, in the theme’s functions.php).

Routine work with documents of the same type can be minimized if you create them based on Word templates. Our material today is about what they are and how to create them.

Quite often, in the course of our activities, we create documents of the same type: acts, orders, letters, contracts, term papers, etc. All these documents, as a rule, contain some text or graphic elements - headings, details, logos, text blocks that are repeated from document to document.

Regular user text editor Word, when creating another document, is forced to use and edit a document that has already been created by someone and contains all these elements, or simply copy the necessary elements into a new document, again, from the old file, moreover, realizing that in this case editing is inevitable.

A template defines the basic structure of a document and contains document settings such as AutoText elements, fonts, assigned keyboard shortcuts, macros, menus, page setup, formatting, and styles. (From Word Help)

This routine can be minimized if you create a document based on a template. Sometimes patterns are also called “fish”. However, no matter what you call it, templates really allow you to significantly increase your work efficiency.

A template can be created in two ways, taking as a basis a document with all the elements present, or starting with clean slate, independently including the necessary elements into it.

I'll show you how to create a template from scratch, making it easier to understand the entire process rather than modifying an existing file. As an example, we will create a simple formal letter template. There is nothing complicated about this if you follow my step-by-step instructions.

So let's get started.

1. Let's create a blank document.

2. Let's save it right away. Let's go to the "File" menu and select the "Save as..." command. The “Save Document” dialog box will open, in which we need to select the “Document Template (*.dot)” type in the “Save as type” field.

This will open the Templates folder, where all templates are saved by default. Give the file a name and click the "Save" button.

3. We determine which elements (text and graphics) and where exactly will be located in the document.

As a rule, all official letters contain elements such as the name of the organization, logo, and details. The text of the letter itself may contain a polite address to the recipient of the letter and, in fact, the text of the letter itself. At the end of the letter is the name of the position of the head of the organization with his signature. We will take a similar structure of the letter as a basis.

4. We will place the name of the organization at the top of the document in the center. To do this, we will print the name of our organization in capital letters, for example, “WHITE NIGHTS” LLC. Press the Enter key and go to a new line.

5. We can insert a dividing line below. To do this, click on the “Drawing” button. A drawing panel with control buttons will appear at the bottom of the screen. We are interested in lines, so we select the corresponding “Line” button. The mouse cursor turns into a cross.

Please note: you may have a so-called canvas inserted - a dotted area for inserting shapes/drawings. To prudently get rid of the canvas insertion, go to the “Tools” menu and select the “Options” command. Click the General tab and uncheck the Automatically create drawing canvas when inserting AutoShapes option. Click "OK" and close the "Options" window.

6. Move the cursor in the shape of a cross to the name of the organization and just below draw a line from the blinking cursor to the right edge of the field, pressing and holding the left mouse button. The line is drawn.

7. You can leave the line as is, or you can give it a more elegant look. To do this, there is a corresponding Line Style button on the drawing panel. Click on it and select any type.

8. Once you have settled on any type of line, double-click below that line - the address and details of the organization will be printed in this place. Type the data that you consider necessary: ​​legal and actual address, telephone, fax, website URL, E-mail, bank details.

9. Now format the typed text according to your ideas. For example, I selected the name of the organization and assigned it the style “Heading 1”. I also centered the title and created a sparse five-point spacing between letters.

I reduced the font size of the text below the line to nine points and aligned it to the center. You can see a sample below in the screenshot.

Thus, we have created a permanent (unchangeable) part of our template, the so-called “header”. Now let's move on and create the fields into which you will later enter your data.

On the left side of the template, under the “header,” double-click and type the name of the city, for example, Moscow. Then, in the opposite (right) part of the template, double-click the mouse again and insert the date where the cursor blinks. For this:

1. In the “Insert” menu, select the “Date and Time” command. A window will open in which you select the desired date display format, for example July 18, 2006.

2. Check the “Update automatically” box. Now, when creating a new document based on this template, the date will already be set in accordance with the current time on your computer.

3. On the right side of the template below the date - indented from the left edge by about 10 cm along the horizontal ruler - double-click the mouse. The cursor will blink, and in this place we will insert a field to substitute the data of the recipient of the letter.

4. In the “Insert” menu, select the “Field” command. A window will open as in the screenshot below:

5. In the Categories area, select Document Automation. In the Field names area, select the MacroButton command. In the "Message" area (Display text), type the text "Insert recipient's full name" and click OK.

Strictly speaking, in the “Macro name” area you should have specified NoMacro (that is, a command without a macro), but it was not in the list. Therefore, we leave it as is, at least I have never encountered any errors.

6. We get a field with our text.

If you have this field displayed as plain text without shading, then I recommend doing such shading. This will allow you to later easily identify the required fields for data entry in the document. To do this, go to the “Tools” menu and select the “Options” command and on the “View” tab, in the “Show” group, select the “Always” option from the Field shading list ).

Below you can additionally insert a similar field for the recipient’s address and position.

All we have to do is insert a welcome message to the recipient of this letter, the text of the message itself and the sender’s signature at the bottom. Try to insert these fields into your template yourself, based on the instructions given above, and do not forget to save the resulting template.

For example, you can take a look at the screenshot of the template I created:

Now, to use this template to create a letter, you need to go to the “File” menu and select the “New” command. A task pane will appear on the right, in which you need to select the “General templates” (On my computer) option. A window will open with all available templates. Select the template you created and click "OK". A new document based on your template will be loaded into Word. Add your data in the appropriate fields and enjoy the automation.

Templates allow you to customize everything required parameters, which you want to pre-apply to document layout, styles, formatting, tabs, text template, etc. You can then easily create a new document based on this template.

When you save a document as a template, you can use that template to create new documents. These new documents contain all the text (and images and other content) that the template contains. They also have the same settings, sections, and page layout styles as a template. Templates can save you a lot of time when you are creating multiple documents that need to have a consistent layout, format, and some template text.

How to save a document as a template

The first thing you need to do is create your document the way you want the new documents to look. Separate the text (and images, etc.) down to the template material you want to display in new documents. Next, customize the page layout (margins, sections, columns, etc.), as well as any formatting and styles you want to use.

Once you have the document you need, it's time to save it as a template. Open the File menu and then click Save As.

After entering a name for your template, open the drop-down menu with the name field and then select the "Word Template (*.dotx)" option.

You have saved your own Word template.

How to create a new document based on a template

Once you have saved your own template, you can create new documents based on it. The easiest way to do this is to simply launch Word.

Its pop-up screen shows a bunch of templates that are built-in or downloadable. At the top of the window, click the "PERSONAL" link to display your own templates. Then all you have to do is click on the template you want, and Word creates a new document based on it.

By default, Word likes to save templates in Documents\Custom Office Templates, where they will appear alongside templates you create in any other Office application.

When you save the template, you can choose a different location if you wish. The problem is that if you save it elsewhere, Word may not be able to see it and display it as an option on the splash screen. If this is not very important to you, save them anywhere. You can create a new document based on a template by simply double-clicking the template file.

You can also open the template in Word so you can edit it by clicking right click mouse over the file, and then selecting the "Open" command from the context menu.

If you want an even more organized approach, you can change the default location. This allows you to save the templates wherever you want (though they still need to be in one place) and have access to them on the Word splash screen.

From the File menu, select Options. In the Word Options window, select the Save category on the left. On the right, enter the path where you want to save the templates in the Default Personal Templates Location field. Click "OK" when finished.

In the end, Word templates functionally similar to regular Word documents. The big difference is how Word processes these files, making it easier to create new documents from them.