WordPress.org

Ready to get started?Download WordPress

Forums

How to write a per-post plugin (3 posts)

  1. carthik
    Member
    Posted 10 years ago #

    1) If I wanted to write a plugin that works on a per-post basis, how would I do it? - Ideally, there should be a dropdown box in the admin New Post interface that lets me choose.
    I want to be able to apply the plugin only to one particular post, or to a string of characters in the post, not to all posts in general.
    2) If I turn on a plugin, say, MarkDown, will the articles published before the time I activated the plugin be affected as well? Likewise, if I turn it off, after publishing a post, will the MarkDown filter still work on that post?
    Thank you in advance. :)

  2. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    We could use the custom fields feature. Add a "Markup Style" field. Plugins could check to see if this field exists. If so, and it is set to a plugin name other than its own, the plugin will leave the post content untouched. This would require passing the post id to the plugin, which we don't do right now for filter style plugins, IIRC. The $post global may be available, however.

  3. carthik
    Member
    Posted 10 years ago #

    What if in the filters for my said plugin, I remove all the filters? I guess the other filters will get added later anyways, right?
    I hope you see my point, which is that it might be better to have plugins that can be applied on a per-post basis, and a tool with which to select this. Especially the text formatting tools, and the_content processing plugins.
    But all this would take architectural changes, or changing the way the plugins have been written, I guess.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.