First time poster here I’m writing a simple plugin to tweet out my posts (really to help me learn about plugins), and want to add a radio button option to the edit post panel that is basically a yes/no toggle, which is then read by my plugin using an update hook, which does the tweeting if set to yes.
From reading the docs, it seems like all fields added to the panel are intended for storing as a field in the post text file. All I want is a radio button that I can read in via a plugin and perform an action if set to yes, and if revisiting the post would always default to ‘no’. Any smart ideas how one would go about this easily?
Thanks in advance,
You could change the value back to
no by using the
$page->update() method inside your hook. Maybe you should use a checkbox instead of a radio button though, a radio button implies that the state is actually changed while a checkbox is often used for one-time stuff.
Thanks Lukas - that’s a great idea - will give it a go. Thanks again.
I solved a similar problem (almost identical actually) in this way:
In my blueprint I have a checkbox and a read only text field
After the site is posted on twitter and tumblr the readonly field is filled with a message
This way I can’t accidentally tweet or post on tumblr twice.
On the plugin side I simply check if the checkbox is checked and the field is empty.
If both are true I can post/tweet and if not I do nothing
That’s a pretty awesome idea, thanks for sharing.