• carthik

    (@carthik)


    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. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    Thread Starter carthik

    (@carthik)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to write a per-post plugin’ is closed to new replies.