wordpress主题修改_更改WordPress主题? 您想做的事情

wordpress主题修改

Sometimes when you’re running a WordPress site, you just want to freshen things up. Sometimes your site becomes stale and you get tired of looking at it. Other times, the design itself becomes outdated – so you decide it’s time to change your theme. This is nothing out of the ordinary, but can cause problems when you least expect it. In this article, I’ll cover some things you should do when changing WordPress themes.

有时,当您运行WordPress网站时,您只是想刷新一下。 有时,您的网站过时,您已经厌倦了查看它。 在其他时候,设计本身已经过时了-因此您决定该更改主题了。 这并没有什么不同寻常,但是在您最不期望的时候会引起问题。 在本文中,我将介绍更改WordPress主题时应做的一些事情。

重新产生缩图 (Regenerate Thumbnails)

Regenerate Thumbnails

Your theme, depending on where you got it, may have its own set of thumbnail sizes for the images it displays. These images could be in your posts or archives, or even search results. When you switch themes, it may not generate the image sizes it needs for these areas. It’ll try to take the existing images and stretch them to fit, distorting your images and ruining the look of your site. Lucky for you, there’s an easy fix, by the way of the plugin Regenerate Thumbnails, which does just that. Install it, run it, and it will regenerate all post thumbnails at the sizes needed for your posts.

您的主题(取决于获得的位置)可能对显示的图像具有自己的缩略图大小集。 这些图像可能在您的帖子或档案中,甚至在搜索结果中。 切换主题时,它可能不会生成这些区域所需的图像尺寸。 它将尝试获取现有图像并对其进行拉伸以使其合适,从而扭曲图像并破坏网站的外观。 幸运的是,通过插件Regenerate Thumbnails可以轻松解决此问题。 安装并运行它,它将以您的帖子所需的大小重新生成所有帖子缩略图。

测试所有功能 (Test All Functionality)

More often than not, you’ll run into issues with plugins and themes. Sometimes certain themes and plugins don’t mix well together. This is usually due to conflicts with the PHP code between the two. Maybe they work against each other and your browser doesn’t know which one to display or override. The sky’s the limit, and it’s a common occurrence.

通常,您会遇到插件和主题的问题。 有时某些主题和插件不能很好地融合在一起。 这通常是由于两者之间PHP代码冲突。 也许它们相互影响,并且您的浏览器不知道要显示还是覆盖哪个。 天空是极限,这是常见的情况。

It’s a good idea to go through and test all of the features of your site. If you have plugins that add extra functionality to your site, you’ll want to make sure those features still work. If not, and they are essential to your site and its success, you’ll need to pick another theme, or code that capability into the new theme yourself. Plugins break often, because everyone codes things differently. It would be impossible to make every theme work with every plugin at all times.

检查并测试网站的所有功能是一个好主意。 如果您的插件为您的网站添加了额外的功能,则需要确保这些功能仍然有效。 如果不是这样,它们对于您的网站及其成功至关重要,那么您将需要选择另一个主题,或者自己将该功能编码到新主题中。 插件经常中断,因为每个人对代码的编码都不相同。 不可能让每个主题始终与每个插件一起使用。

创建子主题 (Create a Child Theme)

If you plan on making major changes to your theme, such as adding custom functions, or coding extra features into your site, you wouldn’t want a theme update to wipe them all out. Before you even get started with making changes to the new theme, create a child theme to handle all of the changes. Keeping the new code separate will make things easier much later, while avoiding possible disasters like losing your work.

如果您打算对主题进行重大更改(例如添加自定义功能或在网站中编码额外的功能),则不希望主题更新将其全部清除。 在甚至开始对新主题进行更改之前,请创建一个子主题来处理所有更改。 将新代码分开保存将使以后的工作变得容易得多,同时避免了诸如丢失工作之类的灾难。

添加自定义代码 (Add in Custom Code)

Custom Code

You can always add in custom functionality to your WordPress site via the functions.php file. However, the custom code I am referring to is tracking code for Google Analytics, custom advertising codes, and any other scripts you might be using. Those don’t translate from theme to theme usually. Many theme makers are making sections in the theme options area where you can copy and paste your codes. You’ll want to make sure to do that in your new theme.

您始终可以通过functions.php文件将自定义功能添加到WordPress网站。 但是,我所指的自定义代码是Google Analytics(分析)的跟踪代码,自定义广告代码以及您可能使用的任何其他脚本。 那些通常不会在主题之间转换。 许多主题制作者正在主题选项区域中创建节,您可以在其中复制和粘贴代码。 您需要确保在新主题中做到这一点。

I can’t tell you how many times I’ve switched themes for a site and forgot to add in that code or custom advertising code from affiliates. Don’t lose out on valuable stats or revenue!

我无法告诉您我已经为网站切换了多少次主题,却忘记添加该代码或会员的自定义广告代码。 不要失去宝贵的统计数据或收入!

数日之内,将旧主题放在手边 (Keep Your Old Theme Handy for a Few Days)

I know your tendency. When you install your new WordPress theme, your initial thought is to delete the old one, but you might want to hang on to it, and I’ll tell you why. A lot of times, we think things are great, and then we’ll discover something wrong which causes a huge hiccup. If you delete your old theme, you have nothing to revert to in times of early trouble. I have learned the hard way to keep the old theme around for the first week, just to have something to revert to in order to keep things going while I handle the issues with the new theme.

我知道你的倾向。 当您安装新的WordPress主题时,最初的想法是删除旧的WordPress主题,但是您可能想要坚持下去,我将告诉您原因。 很多时候,我们认为事情很好,然后我们会发现错误,这会造成很大的打ic。 如果删除旧主题,则在遇到麻烦时您将无法恢复。 我已经学会了在第一个星期保留旧主题的艰难方法,只是为了在我处理新主题的问题时有一些东西可以恢复原状。

You never want to leave yourself in the situation where you’re live and your site is broken. You’ll lose visitors, you can lose revenue, and you end up putting pressure on yourself to make a hurried solution to the problem. Don’t do that to yourself. Be sure to have a fallback method.

您永远都不想离开自己的生活,而您的网站已损坏。 您会失去访问者,可能会损失收入,最终会给自己施加压力,要求他们Swift解决问题。 不要对自己这样做。 确保使用后备方法。

备份整个站点 (BackUp Your Entire Site)

WordPress Backup

Make a backup of your entire site, just in case something major goes wrong. If you pick up a bad theme, you could end up messing everything up. Sometimes hackers will insert malicious code into free themes just to cause destruction and trouble. Don’t be a victim! Backup your entire site, including your database, so that you can restore everything if something major goes wrong. Most hosting companies have a backup utility you can use to backup your site for free. It’s something you should be doing regularly anyway.

为整个站点做一个备份,以防万一重大错误发生。 如果您选择了不好的主题,最终可能会弄乱一切。 有时,黑客会将恶意代码插入免费主题中,从而造成破坏和麻烦。 不要成为受害者! 备份整个站点,包括数据库,以便在出现重大问题时可以还原所有内容。 大多数托管公司都有一个备份实用程序,可用于免费备份您的站点。 无论如何,这是您应该定期执行的操作。

在不同的设备上测试 (Test It on Different Devices)

I know most themes are responsive now, but sometimes a theme just isn’t crafted well for a good mobile experience. Try it out on a tablet and a smart phone. Make sure that the tap areas are large enough and are far enough apart from each other. Play with it, and try to break it. More than 80% of people browsing the web are doing it on a tablet or smartphone now. Make sure it looks great and works properly for them.

我知道现在大多数主题都具有响应能力,但是有时候主题的设计不能很好地提供良好的移动体验。 在平板电脑和智能手机上试用。 确保抽头区域足够大,并且彼此之间的距离要足够远。 玩它,并尝试打破它。 现在,超过80%的浏览网页的人正在平板电脑或智能手机上进行浏览。 确保它看起来不错,并适合他们。

检查帖子和页面的短代码 (Check Posts and Pages for Shortcodes)

This is why shortcodes are both good and bad. If your old theme formatted text or added functionality via a shortcode, it most likely won’t be there now. If you added these shortcodes to posts and pages throughout your site, they won’t be there now. Visitors will just see gibberish code. That’s ugly, and people will think your site is broken. Make sure to go through every post and page with shortcodes that are no longer available, and delete them.

这就是为什么简码既好又不好的原因。 如果您的旧主题通过短代码格式化了文本或添加了功能,则很可能现在不存在了。 如果您将这些短代码添加到整个站点的帖子和页面中,则它们将不再存在。 访客只会看到乱码。 这很丑陋,人们会认为您的网站已损坏。 确保遍历每个帖子和页面,其中包含不再可用的简码,然后将其删除。

结论 (Conclusion)

A lot of people don’t think about these things when they switch to a different WordPress theme. That decision isn’t something to be taken lightly, because there can be a lot of work involved in it. You should choose your themes carefully, and should test your new theme vigorously to ensure that it holds up to your expectations. It’s your job to ensure that your visitors get the best experience possible.

当切换到另一个WordPress主题时,很多人不会考虑这些事情。 做出这个决定并不是一件容易的事,因为其中可能涉及很多工作。 您应该仔细选择主题,并应大力测试新主题,以确保它符合您的期望。 确保您的访客获得最佳体验是您的工作。

翻译自: https://www.sitepoint.com/changing-wordpress-themes/

wordpress主题修改

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值