Jump to content

help with my wordpress plugin


CyberShot

Recommended Posts

I am trying to put together a plugin that will display a form in the admin area that will have two checkboxes.

 

One that says yes,

one that says no.

 

I have done this. it is working

 

The purpose of the plugin is to put in xhtml content into the homepage outside of the loop. I CAN do this without the admin options. Now I am just trying to add this extra bit of functionality to learn how to do it. So on the homepage where I want the xhtml code to show I put in this

 

if(function_exists('adding_content_admin_menu')) { do_it($yes); }

 

In the function do_it() I have passed in the variable $yes. I did this just to try it. I don't know if I am doing it right. The idea is that if they check the yes box, it will call the function do_it which will check to see that yes was selected and then it will call the function

add_google_subscribe_form() which will put the content onto the homepage. Here is all my code. I am sure there is an easier way, I am a beginner and this is one of many different variations. Please explain and instructions as I do not know php very well.

 

<?php
add_action('admin_menu', 'adding_content_admin_menu');

function adding_content_admin_menu() {
add_options_page('Add Content Option', 'Feedburner Signup Form','manage_options','AddFeedburner','adding_content_to_homepage');		
}

function adding_content_to_homepage($yes) {
?>
<p>Add Home Home Page SignUp Form?</p>

<form id="myForm" action="" method="post">
	<table width="200" border="0">
		<tr>
			<td>Yes</td>
			<td><input type="checkbox" id="yes" name="<?php $yes ?>"></td>
		</tr>
		<tr>
			<td>No</td>
			<td><input type="checkbox" id="no" name="<?php $no ?>"></td>
		</tr>
	</table>
	<input type="submit" value="submit">
</form>
<?php

}
?>
<?php

function do_it($yes){
if(isset($_POST['submit'])) {
	if(isset($_POST['yes'])) {
		add_google_subscribe_form();
	}
	else
	{
		return false;
	}
}
//add_google_subscribe_form();		
}

function add_google_subscribe_form() {
$content = "<div id=\"wrapper\">
				<div id=\"background\">
					<div id=\"emailForm\">
						<p>Enter Your Email</p>
					<form action=\"http://feedburner.google.com/fb/a/mailverify\" method=\"post\" target=\"popupwindow\" onsubmit=\"window.open('http://feedburner.google.com/fb/a/mailverify?uri=MtScottChurchOfGod', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true\">
						<input id=\"emailInput\" type=\"text\" name=\"email\" />
						<input type=\"hidden\" value=\"MtScottChurchOfGod\" name=\"uri\"/>
						<input type=\"hidden\" name=\"loc\" value=\"en_US\"/>
						<input id=\"button\" type=\"submit\" value=\"\" />
					</form>
				</div><!--END emailForm-->
			</div><!--END background-->
		</div>";

echo($content);
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.