Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

jwashburn on "Need help with adding an option to a plugin"

$
0
0

I am working on reverse engineering a Plugin to modify it just a bit. Here is the plugin http://wordpress.org/plugins/wodtogether-whiteboards/ Currently it appends some data at the bottom of every post using
return $input . $whiteboardsHtml;

I can change it to post at the beginning of the post just by flipping it around to

return $whiteboardsHtml . $input;

Thanks to @bcworkz. He showed me that on this thread

http://wordpress.org/support/topic/having-trouble-with-adding-content-to-top-of-post-using-add_filter?replies=3

I would like to add an option to the admin section of the Plugin. Just a simple checkbox that says something like would you like this at the top of your posts? If the box is checked then it puts it at the top.

I was able to copy the add_settings_field section from one of the other option to create the checkbox. I was also able to copy the function the same way

add_settings_field('wodtogether_wod_location', 'Show WOD Above Post', 'wodtogether_setting_wod_location', 'wodtogether', 'wodtogether_main');

function wodtogether_setting_wod_location() {
	$options = get_option('wodtogether_options');

	$checked = (isset($options['wod_location']) && $options['wod_location']) ? ' checked' : '';
	echo "<input id='wodtogether_wod_location' name='wodtogether_options[wod_location]' {$checked} type='checkbox' value='1' />";

$wod_location = (isset($wodtogetherSettings['wod_location']) && $wodtogetherSettings['wod_location']) ? '/wod-location/1' : '';

Im stuck on how to create the if statement


Viewing all articles
Browse latest Browse all 8245

Trending Articles