I’m not sure if this is the right place to ask for this kind of help since is not an actual question but hopefully I can learn a thing or two.
I’m developing a plugin (my first one) inspired in the Infinite Scroll Plugin, but instead of showing older posts when scrolling down, I’m showing them when you click a “Show more” link.
My intention is to make it public but I know there are a lot of things on it that I can improve before doing so, I tested it a bit in a couple themes and it worked fine but I’m not sure how it’ll behave in the real world. Here’s a link to it on github: https://github.com/javiervd/Click-and-Load-Pagination
Some concerns at the top of my head are:
– How to handle users including and external jQuery library instead of the WP one? I’m currently queuing WP’s jQuery but I’m not sure how good is this.
– Simplicity? As I said this plugin is based on the Infinite Scroll Plugin so I used a similar but much simpler approach to set the options, hopefully this can be optimized as well.
– Best practices? This is my first “real” plugin I’m sure I’m not following the best practices out there 🙁
I hope some of you guys can help me, I’ll make sure to mention everyone who does when I release it, feel free to fork/request pulls if you wish.
Thanks in advance!
Ok, here are some pointers:
never run any meaningful code right from plugin body (especially don’t start queuing jQuery everywhere like you do – that’s asking for trouble), always do it at appropriate hooks;
learn how to use
$default
argument inget_option()
will save you a lot of typing there;learn how to use
plugins_url()
for reliable URL building to files;learn
submit_button()
, not critical but nifty;consider storing options in single array;
if you use options you should implement uninstall to delete them.