My Plugin Now in Alpha!
Pre-Lesson 1: Delete all the code the tutorials tell you to include. Once I did that, I was able to get my plugin to actually do something.
Of course, that means I probably need to do a good amount of testing to make sure I haven’t left out something that actually is important.
Pre-Lesson 2: Taking apart other plugins might be useful.
I looked through several plugins, trying to figure out where I was going wrong, only to wind up scratching my head trying to figure out why my code, which used similar functions and coding as theirs did, wouldn’t work, whereas their code did.
But, in retrospect, I can see why their code worked and mine didn’t. Refer to Pre-Lesson 1 for the answer to that. Yep, the working plugins lacked the code that the tutorials said I needed.
Anyway, I now have a functioning plugin running on my blog. With it, I can display any number of blogs I want. I just need to input a quantity to show and that’s how many it shows. If I want to show one, I enter “1″. If I want to show five (the current setting at the time of this writing), I enter “5″.
Mind you, I have to enter that number in the source code for the plugin. The next step will be to have an Admin interface where you can set that from within WordPress.
Also, the list of blogs to include is also coded into the source code. That too will need to be something you can set from within WordPress.
Also, if you display more than one blog, it shows them in random order, as it is selecting those blogs randomly. I’ll have to look into changing that so it places the selected blogs in alphabetical order. Of course, hopefully that would be an option whereby you could choose whether to display in random order, alphabetical order or even an order of priority. By priority, I mean that you could order your blog list in order of preference. For example, if your spouse has a blog, if his or her blog is among those randomly chosen, it would appear first in the list. Or, maybe if you have your own blogs in your list, yours could appear higher than anyone else’s.
So, anyway, that’s where it stands for now.



Okay, I have it now where I can present the list in random order or in alphabetical order. It is currently set for alphabetical order. However, they may not appear to be in alphabetical order, as it is sorting them alphabetically by URL rather than by name. But, that will be a project for tomorrow. I’m tired.
You have been Tagged! See my blog for details. ;o)
Nice, you work fast. Eagerly awaiting the Beta release.
I just thought of an approach to selecting the blogs for inclusion. Is there a way to hook into the Blogroll page and add another checkbox next to each listing? That way, all you would have to do is go to the admin interface blogroll page, select the blogs you want in the “hot blogs.” Instead of managing a manual list on the plugin settings page, it would be integrated into the blogroll page. But I have no idea how easy or hard that would be, just a suggestion.
I thought of a variation of that, but I would need to hook into WordPress’ blogroll management loop and essentially override it. If a blog is a “hot blog” it wouldn’t display when the normal blogroll call is made (in the sidebar, for example).
My thought was that, instead of a checkbox, you would just create a “hotblog” category. You would enter your links as usual, but categorize them as a “hotblog” rather than your other categories. My plugin would then stop the “hotblog” categorized listings from appearing in the normal blogroll listing and only display them where you put the tag for the plugin.
Either way, that seems to be rather complicated. Maybe not for someone that’s got a lot of experience digging into WordPress’ code, but certainly for me at least.
Sounds like you’re having fun writing your first plug in! After the nightmare of errors I had today, my goal is to use as few plug ins as possible. As far as any design, I have been taking php tutorials for over a month and going through a WP template design book I have. Good luck with your plug in escapades! I just wish every plugin from wordpress.org had a bandwidth usage chart listed by it
No, it is certainly not fun. This is probably as much a nightmare as you had with the errors on your site. Despite representations that WordPress is “well-documented,” it doesn’t appear to be with regard to writing plugins. And, if it is, it is certainly not very well-organized to where you can find what you need.
Reading a database shouldn’t be this hard. I’ve followed the examples. I’ve tried assorted variations. I’ve examined code from other plugins and, as far as I have been able to determine, my code is correct but it returns no results even though there are results that should be resulting from the call for results. I should return 12 results, but I get 0 results. Done another way, I get 12 results, but that way I cannot extract any data. The way I can extract data is the way that produces 0 results, so I cannot extract data from it because it is returning no results even though it should be returning 12 results.
Sorry about the rant, but it’s no fun spending half a day trying to figure things out and looking up things in the WordPress Codex and looking up things elsewhere online (which is not easy since most search engines results are for other plugins and not help with plugins) and coding and recoding and examining other plugins and you end up no further at the end of the day than you were at the start, which means you’ve pretty much wasted your time.
I don’t mind the rant at all! Here’s mine: My site’s about to give me a nervous breakdown. All my back ups are corrupted, all my new back ups are corrupted…ARGH!!! So, I can’t even move to a new host because I can’t import a corrupted back up. On top of that, my site goes off line every 15 minutes for 5 minutes. I guess it’s just going to be that way for 3-4 more months until I can afford to pay a real database engineer to debug my database. I am extremely frustrated. Sorry about the rant, I can’t think about anything else right now.