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!

  • While asking for code review is fine (although not that popular) I think you might get much better feedback by asking about some of your "concerns" as separate and more specific questions.
    – Rarst
    Commented Jun 22, 2011 at 21:05
  • I think you're right, I was hoping though that someone would point out stuff that I might have overlooked which I know I have :( Commented Jun 23, 2011 at 4:36

1 Answer 1


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 in get_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.

  • Thanks a lot Rarst, I'll start refactoring some code didn't know about the $default argument in get_option() Commented Jun 23, 2011 at 14:56
  • I'm being a newb here but what do you mean by "never run any meaningful code right from plugin body" ? Commented Jun 24, 2011 at 3:50
  • @javiervd most of the time you should not do anything right in plugin file, hook to init (or whatever appropriate, depending on what you are doing) and do things in hooked function.
    – Rarst
    Commented Jun 24, 2011 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.