As a web developer, I spent more than 10 years, especially working on WordPress. I saw a lot of terrible code and wrote a lot of code. So today I think it will be interesting to share and discuss things we don’t like as a WordPress community. So there is no special order to count the 13 things that annoy me the most 1. told inconsistent lies. There is a specific order. I started with what bothered me the most, and the rest was really random. I am honest! Inconsistency is the worst enemy that programmers can encounter when dealing with systems and data structures. The
Are all function prefixes scrambled? Did you save the meta value 1000 times with the wrong key? No problem at all, please search and replace. Sometimes it makes a mess of prefixes, but sometimes remember the correct prefix? You may need to look at the entire code line by line. The wrong but consistently wrong approach is in most cases much better than the right one. Don’t forget to apply this rule when extending the work of others. If camel shells that they don’t like are used, this is what other developers expect, so it is worth absorbing and following. The
2. I really hate the fact that some bloated products provide more than 100 MB of for the \
3. The heap of CSS and JavaScript files is one of my most annoying things. This is especially true for theme producers. This is especially true if you create an advanced theme with the slider and all the other garbage of the current standard. You cannot load 45 JavaScript and 18 CSS files per request. Completely wrong! Rebuttal is usually easier for developers to make changes. Of course, there are solutions for everything. Use sass\/less to build tools such as gulp. Create a developer directory that contains all the original sass and JS files, and use gulp or Gront to merge all the contents into several files. Information about the build process is contained in the project and can be taken over by anyone at any time. The
4. if there is no prepared parent theme to open your theme to the world, someone will want to modify your work. Whenever this happens, we will shout \
5. frankly speaking, I am more upset when reading incomplete documents than when I completely miss them. I mean, why not do 80% of the work and promote the remaining 20%? If you decide to share the project with others, please record! Especially when the code needs to be reused, redefined, or changed – this always happens in themes and plug-ins. If you want to go to the end, developers and end users
A separate document is recommended. End users only need to work with the UI, and developers need to find projects in the code to understand the versions of various components and other information of all types. The
6. although you know that the prefix using function needs to be prefixed, do not use 23duans123uehd_as the prefix. I understand that the possibility of conflict is 0, but it is true that if you develop a mailing list plug-in, the function has the awesomeu maill_prefix awesomeu maill_. If you really want to separate functions, forget all prefixes and use class and object encapsulation, and the problem is solved. 7. put it in the queue incorrectly; if you need CSS or JavaScript, you must put it in the queue, so you won’t say anything to it. Also, note that assets are added to the queue only when needed. Do you want to load styles and scripts for all page sliders? Of course, it is loaded only when the slider is actually displayed. The
If possible, you can also use HTTPS or \/\/sourceofile. Com\/file JS uses \/\/sourceofile. Com\/file JS If the protocol remains unchanged, the browser will handle it by itself. Great! 8. if your wrong definition of web development seems a little rough, do not call web developers when purchasing topics, adjusting and adjusting settings, and teaching clients how to use and complete projects. Before you start throwing stones at me, it is not wrong to do this for the client. How many developers started it, including me. However, calling it web development extends it a little further. The
9. many hard codes that cannot be hard coded fall into this category. A prominent example is the use of the wp_; database prefix in queries. The database prefix can be changed during installation, so you must use the $wpdb->tablename attribute. The location of plug-ins and topics can also change, so do not hard code. Whenever you want to hard code a path, search for \
10. I was lucky to have grown up with English since I was two years old. So in many parts of the world, I can easily understand that software is written in a language I understand very well. Have you ever traveled abroad and hope to read anything? Imagine that network, feel the place where you move information, and feel the confusion and uncertainty of feelings all the time. Translation has become a major part of the WordPress community. There is almost no need to implement translation in products, so there is no reason not to implement it. Both of these functions can be used, and it is not difficult to wrap \u () and \u e () around the text. really The
11. narrow mindedness is actually not only the development of the world, but also the biggest trouble in general. For developers, it is often seen when talking about joomla\/drupal\/wordpress, especially when talking about WordPress. Because WordPress is not a perfect system, many of them ignore WordPress developers. Certainly not typical of modern code. These developers simply missed the point. WordPress is a great tool for specific tasks. Not suitable for all tasks and not intended. People tend to have other considerations rather than their own views, and may have more important considerations. A good example is a developer who wants to rewrite WordPress in order to make it excellent and object-oriented.