👋🏼Welcome to my WP-Host blog where I am excited to share my knowledge and expertise on WordPress hosting and website construction tutorials with you. Let’s connect and learn from each other! You can reach me at info@yrshare.com.

(如果你会中文,可以点击微信图标与我联系。)

扫一扫加我

注:因个人英文水平有限,所以暂时只能为懂中文的朋友提供wordpress建站服务

微信:18200592859 或 yrwordpress

Replace Functions.php with the Code Snippets plugin for easier addition of custom code

Replace Functions.php with the Code Snippets plugin: This article introduces a plugin called Code Snippets that can replace the Functions.php file in your WordPress theme. By using this plugin, you can add all the code that was previously added to the Functions.php file directly to the plugin, making code management much more convenient and not affected by theme updates or changes.

【WP-Host/悦然wordpress建站】

I’d like to continue sharing about WordPress plugins. Although most of the WordPress theme templates we use already have complete functionality, everyone has different requirements. Therefore, in most cases, we make some modifications to the original theme template, which are usually done in the theme’s functions.php file. This is where we can modify the theme or plugin effects, or even disable certain functions, which is very convenient. However, the only issue is that these modifications will be overwritten when the theme updates.

Today【WP-Host/悦然wordpress建站】recommend a plug-in that can replace the theme functions. After updating or modifying, it will not affect the effect of our previously modified code.

This wordpress plugin is Code Snippets, you can search and install it directly in the wordpress background plugin center, or you can download it through the link.

The download address is as follows:

Replace Functions.php with the Code Snippets plugin for easier addition of custom code-WP-Host

Code Snippets

https://wordpress.org/plugins/code-snippets/

Enable directly after installation.

Replace Functions.php with the Code Snippets plugin for easier addition of custom code-WP-Host

After enabling, we add a new code snippet, and then add the function code you need, as shown in the figure above. In this way, as long as the plugin exists, even if you update or change the theme template, this code effect will always exist.

Note: Although this plug-in is easy to use and convenient, we still try to use it as little as possible under normal circumstances. Plug-ins always have some impact on the website, and they are only used when they are necessary.

Well, for ordinary enterprise website construction users, there may not be many code modifications involved. If you want to modify, please be careful, and it is best to consult relevant technical personnel.

Practical code snippets to share

The following are some more practical code snippets I compiled, you can use them directly, add them to the Code Snippets plug-in and activate it to take effect.

继续给大家分享wordpress插件。虽然我们使用的大多数wordpress建站主题模板都已经拥有了较为完善的功能,但是每个人的要求都不一样,所以我们大多数情况都会对原来的主题模板进行一些修改,而这个修改一般都是在主题的functions.php文件中进行的。这里可以修改主题或插件的效果,也可以屏蔽某些功能,非常方便,唯一的问题就是主题更新后这些修改就会被覆盖!

今天【WP-Host/悦然wordpress建站】给大家推荐一个可以替代主题functions.php文件的插件,使用这款wordpress插件我们就不用再去修改wordpress建站主题的functions.php文件了,这样即使主题模板更新或修改后也不会影响我们之前修改的代码效果。

这款wordpress插件为Code Snippets,大家可以直接在wordpress后台插件中心搜索安装,也可以通过我提供的链接下载。

下载地址如下:

Replace Functions.php with the Code Snippets plugin for easier addition of custom code-WP-Host

Code Snippets

https://wordpress.org/plugins/code-snippets/

安装安装之后直接启用。

Replace Functions.php with the Code Snippets plugin for easier addition of custom code-WP-Host

启用之后我们添加新的代码片段,然后添加你需要的功能代码即可,如上图所示。这样只要插件在,即使你更新或更换主题模板,这个代码效果也会一直存在的。

注意:虽然说这个插件很好用很方便,但是正常情况下我们还是尽量要少用插件,插件对网站总有那么一些影响的,只有必须要用的情况下才用,能不用自然还是不用更好,对普通的企业网站建设用户来说,可能需要涉及到的代码修改不会很多,如果要修改请一定谨慎操作,最好咨询下相关技术人员。

实用的代码片断分享

以下是我整理的一些比较实用的代码片断,大家可以直接拿来使用,添加到Code Snippets插件中激活即可生效。

WordPress Hosting / 悦然wordpress建站

WordPress Hosting / 悦然wordpress建站

【WordPress Hosting / 悦然wordpress建站】I am a WordPress hobby from China, and I like to communicate with friends from all over the world to learn WordPress website building and maintenance related knowledge.