From the author: Greetings, friends. In another article on WordPress theme We will look at the question of how to change a WordPress template. If you have never faced the need to change WordPress template, then be sure to read this article, because sooner or later you will most likely have to face the issues of customizing and editing a WordPress template.

First, let's define the most frequently asked questions that users encounter when customizing a WordPress template for themselves. Here is an approximate list of them:

how to edit a wordpress template

change template width on WordPress

how to resize wordpress template

how to change wordpress template color

how to change font in wordpress template

And this is just a small list of problems that you may encounter or that you can help others solve, including for a fee, if you develop custom websites.

All the questions in the list above can be solved in two ways depending on the theme that is used for the site. Let's start from the very beginning simple option, which does not require layout knowledge. This option is suitable if the template supports editing from the settings.

Let's go to the Appearance - Customize section and see home page site and on the left side of the page the available site settings. These may include design settings.

As an example, let's try changing the color scheme of the site. Let's go to the Colors menu and change the background of the side and central parts of the site.

As you can see, this is quite convenient and changing the color of a WordPress template is quite simple - we see the result immediately and can evaluate it.

However, not every theme offers all the WordPress template settings we need. For example, there are unlikely to be settings that allow you to change the width of the template on WordPress, for example, even in the current theme there are no settings that allow you to change the font in the template, and so on. What to do in this case? This is where we will have to resort to the second option, and here some layout skills are already needed.

So, most often we only need to edit one file - the style.css file. It is located in your theme folder. Let's change the font color as an example. By the way, you can do this directly from the WordPress admin area. Just be careful and attentive so as not to accidentally “break” the site. Best do backup copy topic before changing anything in it. So, go to the Appearance - Editor menu and by default you should have the theme styles file open for editing.

If this is not the case, then select this file from the list on the right, it is called Style Sheet (style.css). Most often, the font color is set in the body, so let's find the styles of this element and set red as the font color.

After saving the file, we can refresh the site and see the red color for the main font on the site.

As you can see, customizing a WordPress template for yourself is a fairly simple task. With just a little knowledge of CSS, you can modify your WordPress template and produce necessary settings template. Using the same scheme, we can solve other similar problems. With this I say goodbye to you. Good luck and see you again!

In order to understand how to install and configure the theme and other minor nuances, we will consider an example on a template named “Aldehyde”, which can be easily found in free templates WordPress project.

We go to the administrative panel of the site. Go to the “Appearance/Themes” menu section. Click on the add new button.

In the search, type the name of the topic you are looking for, in our case it is “Aldehyde”. Click on the “install” button and then “activate”. After that new topic will earn. Now we need to customize it for ourselves.

Setting up a theme using the “Aldehyde” template as an example.

In order to start customizing a theme or template, you need to go to the “Appearance” item in the menu and click on the “Customize” button.

In the Header settings section:

  • in the sub-item “title, tagline & logo” you need to add the title, logo and site icon.
  • In the “social icons” sub-item we set social icons. Here you need to provide information in the form of links to social media. site owner's network.
  • Next comes the sub-item “header image”. Here the background image of the header changes.

In the second section Design and layout You can customize the design and layout of the site. In this section you can set the desired display of content on the blog (one or more columns). In addition to displaying content, the section allows you to activate or disable the display of side columns on some pages or even on the entire site. In this section you can also apply various style sheets and set information in the footer of the site.

The Design and layout section contains the following sub-items:

  • Blog layout – blog feed design
  • Sidebar layout – turn on and off the sidebar (side column)
  • Custom CSS – editing template CSS styles for advanced users.
  • Custom Footer Text – Adding text to the site footer.
  • Theme Skins – select a color scheme for the template.
  • Colors. This section allows you to select the color and background of the resource name and description.
  • Google Web Fonts. This section will help you choose different fonts from Google.
  • Background image. Here you can upload the necessary photo or image for the background.

In the next section called Main Slider(Main slider) you can select the appropriate settings for it. But in the initial stage it is not necessary, so it is not recommended to pay special attention to it for now. The disadvantages of the main slider include high resource load. Moreover, this component can rightfully be called an adversary mobile versions sites.

Next comes the Custom showcase section(Custom showcase). Here you can beautifully design 4 blocks with links to important pages of your site.

Next, we will offer sections on widgets and the static nature of the main page; it is recommended to skip them for now, because the static nature of the main page was already customizable, and it is more convenient to configure widgets in the main menu of the designer. To do this, go to the appearance section and click on the “Widgets” button. After this, various widgets for application and use will become available on the left side. By dragging with the mouse, you can move the widget you like to the footer or side columns of the site. After that you need to produce them easy setup and save all actions.

It is very important not to load the side columns of the resource with widgets; it is much more effective to leave only the most necessary ones.

Setting the display and appearance of the menu.

In order to practically customize the display of the resource menu, which can be found in the category " Appearance» you should resort to the following instructions.

  1. You need to give the menu a name and click on the “Create” button.
  2. Add the most necessary top-level pages there.
  3. In the settings of such a page, use the link text for its subsequent display.
  4. You must check or uncheck the box automatic adding top level pages.
  5. Select a location to display the menu on the website. This theme supports two menus in the header.

However, this approach has a significant drawback. The next time you update the theme, all settings often simply disappear, since the theme update overwrites the style sheet files with a new one.

WordPress has a relatively simple mechanism to avoid this shortcoming - Child Themes.

Many bloggers using WordPress doesn't use child themes either because of a lack of understanding of how to use them, or because of the perceived difficulty of creating them.
Next, I will tell you how to customize a WordPress theme for yourself using a child theme and show that it is not particularly difficult.

Why use a child theme?

A child theme allows you to make changes to the site without affecting the main one. source parent theme, and this makes it possible to update the parent theme without deleting the changes.

For a child theme, you need to create a separate set of files that can be used to customize the site without affecting the source code of the parent theme at all, but using the parent theme as a basis. This makes code adjustments much easier, and also ensures that the blogger never messes up his original theme, since he never makes changes to its "core" files. And in case of an error, he can always “turn off” the child theme and return to the original.

How to create a WordPress child theme

Method 1. Connecting styles via the @import rule

To create a child theme, just create a style file style.css and connect the styles of the parent theme to it using the @import rule.
As an example, I'll create a child theme for the Twenty Twelve theme included in the "base package" of WordPress. First of all, on my computer I create new folder for the child theme. I'll call her: /twentytwelve-child/.
In this folder I create a file called style.css and fill the file with information as shown below:

/* * Theme Name: Twenty Twelve Child * Template: twentytwelve Description: My child theme for Twentytwelve Author: Alexander Koval Author URI: https://divitheme.space */ @import url("../twentytwelve/style.css" ); /* set your theme element settings below */

Strings Theme Name(Theme name) and Template(parent theme template) - required, the lines Description, Author, Author URI (author's website) are optional, and it is at the discretion of the creator to be in the topic or not.
The important part of this file is the line: @import url("../twentytwelve/style.css"); This line identifies the parent theme and imports CSS from it. When you create a “child”, you must make sure that the path to your parent theme’s CSS file is correct, and that the “Template:” parameter correctly defines the name of your parent theme. If you are using another theme, set the appropriate names for the other theme.

Please note - all names must be case sensitive: a name with a capital letter and a name with a small letter are different names!

Since my mother theme's folder is called "twentytwelve" and it is capitalized, hence the @import URL takes this factor into account.

Method 2. Connecting styles with code in function.php

To avoid unnecessary calls to the database, which leads to increased page rendering time, Codex WordPress does not recommend using the @import rule to connect parent theme styles

This method creates two files for the child theme: in addition to style.css in the child theme folder you need to create a file function.php and paste the following code there:

In this method, writing @import url(‘../twentytwelve/style.css’); in the style.css file of the child theme is completely unnecessary and the style.css file will look like this:

/* * Theme Name: Twenty Twelve Child * Template: twentytwelve Description: My child theme for Twentytwelve Author: Alexander Koval Author URI: https://divitheme.space*/ /* set your theme element settings below */

How to activate a child theme

Once I have created a child theme folder and a style.css file in it, I can upload the newly created child theme to the server and activate it in WordPress. Downloading and activating a child theme is no different from downloading and activating a regular theme. You can upload it through the “Appearance” -> “Themes” -> “Add Theme” page in the WordPress admin panel.

Please note that before you can download a child theme, you must first create a ZIP archive of its folder. This can be done using almost any archiver.

And also, when activating a child theme, also make sure that you have the parent theme loaded in your WordPress themes folder (in my example, this is the “Twenty Twelve” theme).

Modifying the CSS theme

I have now created a child theme for Twenty Twelve and uploaded it to WordPress. Since in the child theme I import CSS parent, then when activated, the child theme will look the same as the parent theme. To customize my theme, I can add any changes to the child theme's CSS file below the @import line... In this case, all the new CSS information from the child theme is added after the parent theme's CSS is loaded, and therefore the "child" CSS in the SERP is below the CSS from parent theme, which means that everything is new CSS styles will overwrite the original ones.
For example, let's say that in my example I want to change the title of the site. Right now the font is bold and gray, but I want to make it thinner and red. I can add the appropriate CSS to the child theme in the style.css file like this:

/*
* Theme Name: Twenty Twelve Child * Template: twentytwelve Description: My child theme for Twentytwelve Author: Alexander Koval Author URI: https://divitheme.space */ @import url("../twentytwelve/style.css");

/* set your theme element settings below */

Site-header h1 a (color: #FF0000; font-weight: 300;)

Each design theme has a number of settings that can be changed from the CMS control panel. The variety of parameters may vary from template to template, but almost every theme allows you to customize the logo, background, fonts, sidebars, title, and description of the site from the admin panel.

Despite this, the site owner may want to change some little things that the control panel does not allow. In this case, you can hire a webmaster, but if you don’t have money or have time, you can easily figure out the template and make the necessary changes yourself.

The engine theme consists of many files. Knowing what part of the site each of them is responsible for, you can easily edit the design of the CMS template to suit your needs.

The theme files contain HTML, PHP and CSS code. There is a separate reference book on HTML/CSS on the site, but PHP knowledge is basically not required to create a design.

So, any WordPress template has the following files.

1. index.php. The file forms the main page of the site and calls other theme files.

2. header.php. Creates the top, “header” of the site - usually it contains a logo, name, description of the web resource, as well as horizontal menu. HTML container is also in this file.

3. footer.php. Contains the code for the bottom part of the site, its “footer”.

4. style.css. Cascading style sheet file. Since it is usually quite large, style.css well commented. Unfortunately, most often in English, but basic knowledge will be enough to understand which part of the code is responsible for the design of which elements. Read more about CSS here.

This is a required base for a WordPress template, but there are usually many more theme files, and here are the most common ones.

1. single.php- separate post.

2. page.php- page.

3. sidebar.php- side panel/panels.

4. archive.php- archives of articles.

5. search.php- search results page.

6. comments.php- output of comments.

7. 404.php- error page with code 404 (File not found).

8. function.php- a file containing theme functions. You can add your own PHP scripts to it.

Of course, templates usually contain much more files than described above, but they usually do not need editing. In addition, you can learn about the purpose of each file from its name and comments inside.

Editing templates is often required to correct or add some small detail. Below are a few common situations.

Add menu

Menus can be placed not only in places set by theme(this is done through widgets), but also in any other part of the site or even on a specific page.

To insert a menu anywhere, add the line:

directly into the page code where you want to place it. The line will work if there is only one custom menu on the site. If there are several, you should add a line like this to the code:

"Menu_1")); ?>

where instead of Menu_1 you need to enter the name of your menu.

Change 404 page

If the link leads to a non-existent page or file, WordPress takes the user to an error page with the code 404 (File not found). The file is responsible for it 404.php, stored in the active theme folder. Often English text is displayed on the screen, and the desire of the owner of a Russian-language site to translate it into his native language is quite understandable.

To change the contents of the page, open the file in the editor 404.php, find the lines with the text displayed in the browser and change them (the displayed text is most often enclosed in quotes). For example, in one of standard themes(twentyfourteen) you will be interested in the following code:

Replace the text in quotes (not where twentyfourteen is, but something else) with your own and get a modified 404 page.

Register copyright

At the bottom of the site it is customary to write official information, in particular, the years of operation of the resource and copyright. In the vast majority of cases, your “label” in the file footer.php left by the authors of the themes, and webmasters, naturally, want to replace this information with their own.

As we know, the “legs” of the site are responsible for the file stored in the root of the active theme footer.php, and you should look for the code responsible for copyright in it.

For example, the flat-white theme hides supporting information in the following lines of this file:

" title=""> ">

Russify text

Often, WordPress templates are not fully Russified or not translated at all. Knowing the file structure of the theme and the fact that the text shown to the user (if it is not a variable) in the code is always enclosed in quotes, it is easy to find and independently translate the desired fragment, and it is not necessary to search for the word manually - for this you can use the automatic search, which is present in every code editor.

For example, in the flat-white template you immediately want to Russify at least two inscriptions: “READ MORE” and “Leave a Comment”, since they are visible on the main page.

The file is responsible for the main page index.php, located in the root of the theme directory, therefore, you need to edit it. But there is no text for the inscriptions, so you need to understand the code to find out where they are stored. In our case, the file is responsible for the information under the posts on the main page template-parts/content.php, connected by string

If you go into it and in the code

".__("Leave a Comment", "flat-white")."
"; ?>
" class="read_more">

text Leave a Comment replaced by

1. Template setup

1.1. Adding a copy

1.2. Sales and SEO

1.3. Copy structure

1.4. Outsourcing or DIY?

1.5. Adding content to the site

2. Other pages

2.1. Adding and customizing a contact form

2.2. Adding Google Maps

Together we have already established the most important elements, it's time to talk about the content. In this tutorial, we'll take a look at other types of websites and all the aspects associated with them. Let's start with the basics and create the first post on your site. Let's write, for example, something like “Hello, world!”

To start creating your first post, go to your dashboard WordPress/Posts/Add new. Here you will see many editing options. Here are some basics of creating posts on a WordPress site:

1. Don’t use hackneyed phrases and clichés. Be original.

2. Know your audience and try to communicate with them in their language. If your readers like humor, be funny. If they need as much information as possible, be direct and informative.

3. Don't overdo it with punctuation.

4. Don't adopt a condescending tone.

5. Create easy-to-read texts. Make sure the information is relevant to the overall topic:

- Headings;

— Subheadings;

— Markers;

— Numbered lists;

- Bold font;

— Italics and underlining.

6. Be passionate about what you write about. This is the only way to create a meaningful post and grab the reader's attention.

7. Headings in tandem with exciting and interesting content are more than important.

8. Pay attention to titles.

9. After you come up with a title, ask your friends and acquaintances for their opinions. If they're not happy, try to come up with something else.

10. Avoid obscene words and expressions if they are not used in an ironic context.

11. There should be no slang vocabulary.

12. Use videos/images to illustrate texts.

13. Don't be afraid to be original.

14. Play with words.

It is very important to SEO optimize website pages, especially if you are selling something through your resource. There are several reasons why your website content should be search engine friendly. First of all, SEO optimization increases loading speed and increases traffic. This functionality is vital for any website whose goal is to attract visitors and turn them into clients. Remember that your content must be informative and easy to read if you do not want to lose a large part of your audience.

Don't overload your text with long keywords and phrases. Even if your site ranks highly in Google search results, but the content on the site is of poor quality, you will not see a noticeable difference in traffic growth. The point is that you must also develop a proper marketing strategy related to the topic of your resource and the material published there.

Writing SEO optimized texts is actually much easier than it might seem. Just follow the rules below:

Work with 1-2 keywords in the text. The same keywords can be used in meta descriptions, titles and URLs;

Optimize images and use alternative text. Important: Use one short keyword in picture descriptions.

Use links. This point is very important. Link the publication with 1-2 posts already existing on the site on similar topics that have a high rating. It is also recommended that the keywords be related to each other and each link opens in a new window.

If you do not want and are not going to write texts for your website yourself, you can always delegate the task to freelance writers.

It makes no difference who will write texts for the site; in any case, you will publish them. Let's figure out how to add new content to site pages.

Before logging into the WordPress admin panel of your site, follow these steps:

1. In the toolbar, select Records;

2. Click Add new;

3. Fill in all fields, starting with the title;

4. Enter your text or copy it into the text field;

6. When you are done editing your post, click Publish.

It's time to talk about adding plugins that can be useful for your site.

Contact form is a must-have plugin for any modern website or blog. Our Cherry Framework includes already built-in Contact Form 7. Let's see how you can customize it.

1. Go to Plugins/Installed.

2. You will see that the Contact Form 7 plugin is already installed.

4. Here is the default contact form. To configure it, click Change.

5. Change the name of the contact form and save the changes.

6. In the field Form template you can insert between tags.

7. In the block Letter you can also change the settings in all available fields.

8. Copy the code Contact form and paste it into your post.

Another plugin that may be useful for your site is Google Map. You can use it to show your address and indicate coordinates on the map so that users can determine your location.

That's it at this stage. We hope you didn't have any problems customizing the template.

If you missed our previous WordPress tutorials, use the links below to fill in your gaps.