未加星标

7 Easy Tips to Create Better WordPress Themes

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二04 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

Developing a WordPress theme is a complex task. We need to create a system which can handle a lot of content in a well-styled manner in any situation.


7 Easy Tips to Create Better WordPress Themes

We have to meet coding standards, and we have to support a bunch of plugins. The tasks sometimes are infinite.

Lately, I am developing a more straightforward WP theme (named Alpha) to submit into the official theme repository. So I have some wisdom to share with you if you are interested in making better WordPress themes!


7 Easy Tips to Create Better WordPress Themes
Pine’s first WordPress theme named Alpha. (Work in progress…) Learn From Other Themes

A good tactic if you dig through the popular theme’s functions and code. Go the official repo and filter the popular ones, download it and start to explore. Check out what they can do and how!

In this way, you can learn a lot from not just the theme development but about other developer’s thinking. Downloading the new native theme ( twentysomething ) is a must. These are high-quality themes where you can find the latest features too (like I found the starter-content method).

For me, the most exciting part was the option and customizer frameworks. These two can help you a lot but there too many of them. Choosing one is hard and critical for future development. So I read through some source code and found the bests for me.

Use a WordPress Theme Starter or Framework

If you develop more than one theme, you should use some WordPress theme framework (it can be your own or can be community developed).

I’m not a big supporter of the bloated systems, so I get with _s which a lean starter theme. For me, it is more than ideal.

Pick one which is the best for you and works well there are a lot of them to choose from. Be cautious about the support and try to find a well-documented and secure system.

Start With Full Test Content

One of the first steps of the development should be the adding of the test content. The Theme Unit Test is a great starting point which helps you find the unformatted elements and the bugs.

Note that now we have Gutenberg which required more from the theme developers. Fortunately styling the default blocks is as easy as in the case of TinyMCE but it can be tricky. To generate test content check the Block Unit Test for Gutenberg plugin!

Add Less Feature

This step is almost always correct. If you want to make a remarkable piece of code, you must have to make it as smooth and light as possible.

More feature doesn’t mean better themes. Sure you can create multi-purpose themes, but in my opinion, the users don’t need 100+ Google Font. Not to mention that it is impossible to optimize your design for a lot of fonts because every one of them is different in some way.

With every newly added feature, you add complexity to your theme although mostly it does not give so much value to it. It makes your work harder, your code less maintainable and of course it can make the overall performance worse.

Next time you start to develop a theme not just think about the features that can be added but the ones which can be removed.

Reach Out For Dependencies

Developing a great theme without any dependencies is possible but hard. For me, the two necessary ones were the Kirki and CMB2 plugin. I build on the top of these great extensions of Alpha’s main features.

To require them I used the TGM Plugin Activation where I also set up recommendations too like Yoast SEO and Jetpack which features are also supported in the theme but not needed for the run.

Another dependency is WPGulp which is needed for the development tasks. It is easy to use and a fantastic tool optimized for WordPress development!

Using well-supported dependencies is advantageous. We can focus on other tasks, and the extensions are always up to date because of some great developer.

Test your theme like never before

The Theme Check plugin is the first step to submit a theme to wordpress.org . This plugin runs your code against thousand of tests if it passes then right, if not correct the mistakes and measures the recommendations.

Cross browser testing should also be a default. The newest browsers quite goods but still can be problems in some cases especially if you use more modern techniques like CSS Grid.

If you can give your theme test to other people too. You see your project all the time, and after a while, you can’t notice the bugs.

Make Great Starter Content

To show the theme’s real potential, you should include starter content. From version 4.7 WordPress support a native way to present in the Customizer and after a save to show it live.

I wrote about it previously, check it out!

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

代码区博客精选文章
分页:12
转载请注明
本文标题:7 Easy Tips to Create Better WordPress Themes
本站链接:https://www.codesec.net/view/621193.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(50)