WordPress.org

Ready to get started?Download WordPress

Forums

Plugin guidance wanted (1 post)

  1. CptDondo
    Member
    Posted 9 years ago #

    I'm in the process of writing my very first plugin for WP. You can see a rough example at http://www.seiner.com/blog/Travels/ with the 'Image Test Post'. It pops up a window to show a larger image, along with some other functionality. Mostly, it provides a way to show a thumbnail, a snapshot (640x480 in my case) and the full resolution (~2000x1000 px) for download. I threw in the email and the print buttons just to learn javascript...

    I would like to add previous / next buttons. The way I read the docs, I can either use an action or a filter. An action would modify the post before it went into the database, whereas a filter modifies the post on the fly as it is sent to the client. Do I have that right?

    Which is the preferred method? If I use action on save_post, I would need to read in the entire text of the post, parse out the images, and rewrite the href tags to include the appropriate tags for previous and next images. The advantage of this is that the post is only modified once, but it mucks about with the original post, which I am not entirely comfortable with.... Also, I have to recognize tags that I've already modified....

    OTOH, a filter would be executed every time the post is requested, so CPU usage would be high.... But it leaves the original post untouched.

    So.... Any guidance? Any other suggestions? I have not found any other image viewer plugins that implement prev/next buttons. Anything I am missing? It seems that a filter would be easier to implement, if less efficient...

    Thanks,

    --Yan

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.