The title of this article is really \
So when my daily log leads me to stop worrying and try to create a plug-in, please hold my hand, OK? It didn’t make me a developer, but I did learn oneortwo things. Enjoy! For the format sentence, I can only deal with a small part of the coding process every day, so I classify it according to it. Although the reading may be somewhat uneven, I think this is the best way to communicate how plug-in creation is actually interrupted. Take it as if you are getting rid of your worries from my diary. If you want to tell me the story of ugly plug-in generation in the tools and tutorials I use, I have compiled a list of tools and tutorials to make it possible. The
Tools don’t actually require many tools. What I need is: FTP client: Although Cyberduck is used, it works. Sublime text: the convenient code editor for Mac keeps the code clean and tidy. If there is any problem, you will be notified. Mamp: this is a great application. You can set up a remote server to install the local version of word press. Start developing tutorials and resource text imprinting plug-ins: The Ultimate Guide: I decided to test Daniel Pataki’s tutorials. It’s really simple and easy to imitate, so it’s good for plug-in fools like me. Describes how to create a plug-in that integrates the Facebook open graph meta tag. WordPress Essentials: how to create a WordPress plug-in: another Daniel Pataki tutorial to add a post view tracker to the site. How to create a WordPress plug-in: this useful tutorial, written by Andy leverenz, will guide you in creating custom post types. Create custom content in WordPress: custom post type: the last tutorial I consulted, written by my own Rachel mccollin. Briefly describes how to create a custom post type and add a template. See the WordPress Code: if you need to search for something, meaning, or how it works, be prepared. Day one: I can do it! Full of pure enthusiasm and positive ideas, open the tutorial and start working. The goal is to add the Facebook open graph tag to the site title. The first step in Daniel’s tutorial is to create a folder named my facebook tags in the WP content \/ plugins\/ directory of WordPress installation. The
First, create a folder on the server. Next, you must create a PHP file to enter the folder. ‹ PHP files and folders. Then, just copy part of the tutorial code from and paste it into this file. I opened it and quickly typed the code there. The progress here is quite smooth. Well, it’s amazing. I want to go to my dashboard and make sure the plug-in is visible
. I can’t even begin to explain how interesting it is. Ouch. It’s completely there. Am I a developer now? Well, I think I’m ahead of me. But still. It’s interesting to be a person who occasionally changes only a little. The
The plug-in was activated according to Daniel’s instructions. Although nothing has been done, this is a plug-in that can run in real time. Here, the tutorial continues with the hook. I won’t repeat everything Daniel said. Because it won’t make good use of our time here. But Hooke’s concept was surprisingly simple. If these terms have caused you unhappiness in the past, please don’t let them scare you. Day 2: shall we make this plug-in? After discussing what a hook is and how it works, the next part of Daniel’s tutorial begins by adding functionality to the wp\u head hook on each page of the site. When you add functionality to this hook, something is output in the page header. Obviously, there are action hook and filter hook, but the tutorial is sure that you don’t need to know everything to complete the creation of the plug-in. You must add a function to wp\u head to call these meta tags from the title of my site. The
The rest of the code is my facebook tags, which was created earlier. Simply copy and paste into a PHP file. The Facebook open graph code is very simple. As you can see, the my\u face\u tags function has been added to wp\u head hook. This code snippet uses the default tags introduced on Facebook and uses the word press template tag to define tags to load post information, such as post title, site name, URL, post description, and post type. The only change Daniel made was to use the conditional tag is_single() to add a meta tag to the title only when a single post is displayed. The
On my site, you are not sure what it looks like, but you can go to open graph debugger to see what it looks like. I’m not an expert, but I can’t see clearly. No. Things are terrible. So I opened the website to see what it looked like. What might the plug-in break Male: Wu Yi. I did break something. Ouch. No one wants to see anything on a white screen when loading a website. Before I started hyperventilating, I went back to find out what I had done to make this a mess. Daniel’s code was copied into my plug-in file again, and my site was pasted, saved, and reloaded. Although everything returns to normal, the debugger still displays errors. This shows that there are multiple og:url values. Um. The
I searched the Internet. Now it seems that there are plug-ins that conflict with the plug-in generation. After disabling my plug-in, good open graph output will appear. Further investigation shows that the SEO plug-in I activated also contains open graph information, which hinders the my facebook tag plug-in. The SEO plug-in is temporarily disabled, and the debugger retests the new plug-in. There was no error this time, but something strange happened to the social sharing button on the site title. This test should be called \
So it was a mess. I also forgot that the plug-in to add Facebook open graph data has been installed, which is a bit silly. I also forgot to perform all these tasks on the test server. But through this experiment, there are several
I learned a lot. How to create plug-in folders and files. How to configure PHP annotations. Methods for adding features to a hook. The basic introduction to conditional labels, so everything is not in vain. But I am not satisfied with the exam. I want to create a plug-in that actually runs on my site without claiming that the effort is \
Day 3: restart a new day and try to create a new plug-in. I decided to work here. Start by eliminating all possible plug-in conflicts. I should have done this at first, but you live and you study. Open map, reinstall word press on the local host, and start the day’s work. I’ve tried it before, but I didn’t expect to do it at the beginning, so I was surprised. If you need help, please provide a complete tutorial. The main idea is to show the plug-in development on the site, but no one will have the right idea, so we have completed the first step. The
Did I mention that I am forgetful? I cheated. Today’s plug-in begins by finding a new tutorial to use. Interestingly, fast Google also disclosed another tutorial written by Daniel Pataki on Smashing Magazine a few years ago. Describes all the basics of how to create a plug-in. The plug-in he created records the number of times the post has been viewed and outputs this information to the user. Of course, you can use the hook, so you can quickly read and get started. I create a folder named population\u tracker, and then a file population\u tracker. Located in the plug-in folder of the site within PHP. Then, we first pasted the regular metadata. The plug-in started like my first attempt. We pasted a piece of code to set the function that occurs when viewing a post. In this case, the goal is to record every time you view a post. Fearing that the code would get bad again, I didn’t want to modify the code, so I performed a simple copy and paste operation. The only customization I do is the name of the function. Then paste it into the operation. This is the same as the first plug-in I tried to create, which is set to run when wp\u head is loaded. Well, now the plug-in is set to record every time you view the post, so the next step is to search the click through rate of the post and display the information. The following code snippet contains many variables to intelligently display the number of queries. For example, if a post has only one click through rate, it may be embarrassing to use \
You can specify styles in a dithering fashion. To do this, we went to another tutorial and completed the operation, but the operation of creating a template is slightly beyond our experience. Hey, maybe next class? I posted a post, but it didn’t appear on the front end. To solve this problem, I disabled the new plug-in, but re enabled it. In this way, a \