wordpress主题修改_更改WordPress主题的10个步骤指南

wordpress主题修改

Changing your WordPress theme is, on the surface, a very easy process: find a theme, install it and click activate. Done. Well, not quite. In reality, there’s a lot more that needs to be done before, during and after installing a new theme and in this article we’re hopefully going to stop you from making lots of unnecessary mistakes by showing you our 10 step guide to changing your WordPress theme.

从表面上看,更改WordPress主题是一个非常简单的过程:查找主题,安装主题并单击激活。 做完了 好吧,不完全是。 实际上,在安装新主题之前,之中和之后还有许多工作要做,在本文中,我们希望通过向我们展示更改WordPress的10步指南来阻止您犯很多不必要的错误。主题。

通过备份避免崩溃和烧伤 (Avoid crash and burn by backing up)

When you activate a new theme, some things are permanently changed. Even if you remove it and reactivate your old theme, not everything is guaranteed to work as it did. In addition, you might find that your new theme has compatibility issues with your plugins and causes internal errors that break your entire site. If this happens, you need to be able to restore your website back to its pre-installation, working version.  So, before you start the process, backup your entire website, including the database.

激活新主题时,某些事情会永久更改。 即使您删除了它并重新激活了旧主题,也不能保证所有内容都能像以前那样正常工作。 此外,您可能会发现新主题与插件存在兼容性问题,并会导致内部错误,从而破坏整个网站。 如果发生这种情况,您需要能够将您的网站还原到其预安装的工作版本。 因此,在开始该过程之前,请备份整个网站,包括数据库。

告诉访客您正在更新 (Tell your visitors you’re updating)

WP maintenance mode

Installing a new theme properly takes time and means your site can be offline for a while. If you have a mailing list, send out an email telling your regular visitors what’s happening and when. This way, they will know not to visit at those times.

正确安装新主题需要花费时间,这意味着您的网站可能会离线一段时间。 如果您有邮件列表,请发送一封电子邮件,告诉您的常规访问者发生了什么事情以及何时发生。 这样,他们将知道在那个时候不访问。

At the same time, download and install a ‘maintenance’ plugin. You can configure this to let visitors know that you’re temporarily offline for scheduled maintenance.  This will stop people seeing a half finished website when they visit.

同时,下载并安装“维护”插件。 您可以对此进行配置,以使访问者知道您暂时离线以进行计划的维护。 这将阻止人们在访问时看到半成品的网站。

如果您有页面生成器,请复制并保存您的内容 (If you have a page-builder, copy and save your content)

Many themes, especially from third-party companies like Theme Junkie and Elegant Themes, come with a built-in ‘page builder’. These page builders enable users to create page templates and designs that are difficult to achieve with just a WordPress text editor.

许多主题(尤其是来自第三方公司,例如Theme Junkie和Elegant Themes)都带有内置的“页面构建器”。 这些页面构建器使用户可以创建仅使用WordPress文本编辑器难以实现的页面模板和设计。

One of the problems with page builders is that you input the content directly into their templates rather than into the WordPress text editor. This means, that when you change the theme and the page builder becomes inactive, the content disappears.

页面构建器的问题之一是您将内容直接输入到他们的模板中,而不是输入到WordPress文本编辑器中。 这意味着,当您更改主题且页面构建器变为非活动状态时,内容将消失。

The only way to put it back again is to copy the content before you change the theme and paste it back into the WordPress text editor when you have finished. Unfortunately, you will only have the content, not the original layout which the page builder created, so you will need to reformat this too.  If most of your content was built using this method, this could take some time to do.

再次放回原处的唯一方法是在更改主题之前复制内容,并在完成后将其粘贴回WordPress文本编辑器中。 不幸的是,您将只拥有内容,而没有页面构建器创建的原始布局,因此您也需要重新设置其格式。 如果您的大多数内容都是使用此方法构建的,则可能需要一些时间。

检查您的旧主题的小部件 (Check your old theme’s widgets)

Some themes come with their own built-in widgets, just like the page-builder mentioned above, these widgets will disappear when you change your theme. If you have used these widgets, make a note of what you have used them for and if you can, copy the content. For example, if you have an advertisement widget, copy the code for the advertisement. Your new theme may have its own version you can copy it back into, or alternatively, you may have to use a text widget instead. There is, however, no guarantee that the functionality you had will be replaced by the new theme.

某些主题带有它们自己的内置小部件,就像上面提到的页面构建器一样,当您更改主题时,这些小部件将消失。 如果使用了这些小部件,请记下它们的用途,并尽可能复制其内容。 例如,如果您有一个广告窗口小部件,请复制广告代码。 您的新主题可能具有自己的版本,可以将其复制回该主题,或者,您可能不得不使用文本窗口小部件。 但是,不能保证将原来的功能替换为新主题。

记录脚本更改 (Keep a record of your script changes)

Many WordPress users do low-level modifications to their theme by making changes to the functions.php file or by customising CSS. Some themes allow you to do this with a special editor, some people create a child theme, whilst others modify the actual theme itself. Whatever modifications you have made will disappear when the theme changes.

许多WordPress用户通过更改functions.php文件或自定义CSS对其主题进行了低级修改。 有些主题允许您使用特殊的编辑器执行此操作,有些人创建子主题,而其他人则修改实际主题本身。 主题更改后,您所做的任何修改都会消失。

Quite a lot of these modifications, for example, changing font size, may be irrelevant when you change the theme as the new theme may offer better alternatives. Others, however, might be vital whatever theme you use. If this is a case, make a note of the changes so you can add them back in. Importantly, when you do, don’t edit the original files as these will be written over if you update the theme to a newer version – instead, use a child theme or a built-in editor.

当您更改主题时,很多此类修改(例如,更改字体大小)可能都是不相关的,因为新主题可能提供更好的替代方法。 但是,无论您使用哪种主题,其他主题都可能至关重要。 在这种情况下,请记录下所做的更改,以便将其重新添加。重要的是,在进行此操作时,请勿编辑原始文件,因为如果将主题更新为较新的版本,这些原始文件将被覆盖。 ,请使用子主题或内置编辑器。

准确记录配色方案 (Keep an accurate record of colour schemes)

accurate record of colour schemesIf you want your website to keep the same colour scheme, you will probably need to customise the CSS of your new theme. Make sure you keep a record of the number codes you use.

These will be six figure combinations of letters and numbers with a hashtag at the beginning e.g. #b3f090.

这些将是字母和数字的六个数字组合,开头带有#号,例如#b3f090。

It’s important that you record these accurately if you want text colours and backgrounds to match perfectly with existing images that have been used for a colour scheme.

如果希望文本颜色和背景与已用于配色方案的现有图像完美匹配,则准确记录这些很重要。

 

Post Installation

安装后

In the next section, we discuss what you need to do after you have installed the new theme. If you need help doing this read our article on how to install a WordPress theme. If you’re still looking for a new theme, we have a handy guide to helping  you choose the right theme, which you may find useful, too.

在下一节中,我们将讨论安装新主题后需要执行的操作。 如果需要帮助,请阅读我们有关如何安装WordPress主题的文章 。 如果您仍在寻找一个新的主题,我们将提供一个方便的指南来帮助您选择合适的主题 ,您也可能会发现它有用。

重新配置您的设置 (Reconfigure your settings)

One of the first things you may notice after you have installed a new theme is that your homepage disappears. This is because your new theme may have reconfigured WordPress back to default settings. As a result, your homepage may now be set to ‘posts’ rather than a static page and you will need to change it back again. This maybe only one of several issues that need fixing. Others include:

安装新主题后,您可能会注意到的第一件事是首页消失了。 这是因为您的新主题可能已将WordPress重新配置回默认设置。 结果,您的主页现在可能设置为“帖子”,而不是静态页面,您将需要再次将其更改回。 这可能只是需要修复的几个问题之一。 其他包括:

  • Missing sidebars – you may need to configure page layout settings.

    缺少侧边栏–您可能需要配置页面布局设置。
  • Missing custom sidebars – you will need to retell the sidebar plugin which sidebar to replace.

    缺少自定义侧边栏–您需要重新记录侧边栏插件以替换哪个侧边栏。
  • Wrong menu showing – you will need to put the right one back in the menu options.

    菜单显示错误–您需要在菜单选项中放回正确的菜单。
  • Missing header images – your new theme will need to know what image to use. (Note: your existing image may be the wrong size for your new theme.)

    缺少标题图像–您的新主题将需要知道要使用什么图像。 (注意:您现有的图片可能与新主题的尺寸不符。)

配置新主题 (Configure your new theme)

Your new theme will have its own defaults and you may want to change these to meet your needs. You will need to go to your ‘theme settings’ or ‘customize theme’ options to change these.

您的新主题将具有其自己的默认值,您可能需要更改这些默认值以满足您的需求。 您将需要进入“主题设置”或“自定义主题”选项以进行更改。

Some themes have very few options available which can be restrictive; at the other end of the scale, there are themes with so many options that setting up can become quite a laborious process. As a rule, always have your theme’s documentation handy to save you making mistakes.

有些主题的可用选项很少,可能会有限制。 另一方面,有些主题具有很多选择,因此设置可能会变得非常费力。 通常,请始终准备好主题的文档,以免出错。

图像问题 (Image problems)

One noticeable problem when you change theme is that the images which looked fine on your old theme now look blurry. The reason for this is that different themes have different default image sizes.

更改主题时,一个明显的问题是,在旧主题上看起来不错的图像现在看起来模糊了。 原因是不同的主题具有不同的默认图像大小。

When you upload an image to WordPress, it keeps the original image (what it calls ‘full size’) but also creates several different versions – thumbnail, medium and large. If the large on your old theme was 800p x 500p and the large on your new is 1000p x 650px, the original images will be stretched to fit the new dimensions and this will make them look grainy or blurred.

当您将图像上传到WordPress时,它会保留原始图像(所谓的“全尺寸”),但还会创建几个不同的版本-缩略图,中型和大型。 如果旧主题的大尺寸为800p x 500p,而新主题的大尺寸为1000p x 650px,则原始图像将被拉伸以适应新尺寸,这将使它们看起来粗糙或模糊。

To fix this you need to install a plugin called Regenerate Thumbnails. This plugin will use your original ‘full-size’ image to make a new set of thumbnail, medium and large versions that match the image size of your new theme. Depending on how many images you have, it can take quite a while to process.

要解决此问题,您需要安装一个名为Regenerate Thumbnails的插件。 该插件将使用原始的“全尺寸”图像制作一组新的缩略图,中型和大型版本,以匹配新主题的图像尺寸。 根据您拥有的图像数量,可能需要花费相当长的时间来处理。

测试您的新主题 (Test your new theme)

Once you are happy with the configuration of your new theme you need to ensure that all the functionality you had previously, still works. This includes: checking responsiveness on different devices; ensuring payments gateways and user logins work; make sure all pages, posts, product pages and other content types are displaying as expected; check essential info is still accessible (T&Cs, privacy policy, contact page, etc.); make sure widgets are displaying properly and that all plugins are compatible; finally, check that all navigation methods work (menus, breadcrumbs, internal and external links, image links, etc.).

一旦对新主题的配置感到满意,就需要确保以前拥有的所有功能仍然可以使用。 这包括:检查不同设备上的响应; 确保支付网关和用户登录正常运行; 确保所有页面,帖子,产品页面和其他内容类型均按预期显示; 检查基本信息是否仍可访问(条款和条件,隐私政策,联系页面等); 确保小部件显示正确并且所有插件兼容; 最后,检查所有导航方法(菜单,面包屑,内部和外部链接,图像链接等)是否都有效。

In addition, it is advisable to check that your new site loads quickly – to do this visit Google’s PageSpeed Insights and test a range of your pages. If the new theme loads significantly slower, this may affect your site’s ranking. To rectify, follow the suggestions given by PageSpeed Insights after your tests have been completed.

此外,建议您检查新网站是否快速加载-为此,请访问Google的PageSpeed Insights并测试您的页面范围。 如果新主题的加载速度明显变慢,则可能会影响您网站的排名。 要进行纠正,请在测试完成后按照PageSpeed Insights给出的建议进行操作。

结论 (Conclusion)

Updating your WordPress theme can be very beneficial, not just in terms of appearance but also in terms of speed and additional functionality. However, from reading this article, you will be aware that is not as straightforward as it first seems and that to avoid major issues you need a methodical approach.

更新WordPress主题可能非常有益,不仅在外观方面,而且在速度和其他功能方面。 但是,通过阅读本文,您会发现这并不像初看起来那么简单,并且要避免重大问题,您需要采取有条理的方法。

If you are using a WordPress website and are looking for a WordPress dedicated web host, visit our WordPress Hosting page.

如果您使用的是WordPress网站,并且正在寻找WordPress专用的虚拟主机,请访问我们的WordPress托管页面。

翻译自: https://www.eukhost.com/blog/webhosting/10-step-guide-to-changing-your-wordpress-theme/

wordpress主题修改

你可能感兴趣的:(wordpress主题修改_更改WordPress主题的10个步骤指南)