[wp-hackers] Front Page Displays - WordPress 2.5
Aaron Harun
admin at anthologyoi.com
Sun Apr 6 16:20:03 GMT 2008
Here is some pseudo-code that should do what you want. All you have to
do is create a drop down list that you fill with page titles -- you
will want to clean the titles before using them -- and IDs. Later you
check to see if the current $id is the same as the one saved.
Aaron.
<?php
function admin(){
$pages = get_pages();
if ($_POST["mypage"]) {
update_option('page_id_plugin_should_display_on',$_POST["mypage"]);
}
?>
<form method="post">
<select name="mypage">
?>
<?php foreach($pages as $page){?>
<option value="<?php echo $page->ID"><?php echo $page->post_title;?></option>
<?php }?>
</select>
<input type="submit">
</form>
<?php
}
add_filter('the_content', filter);
function filter($content){
global $id;
$mypage = get_option('page_id_plugin_should_display_on');
if($id == $mypage){
$content .= 'Some cool feature';
}
return $content;
}?>
More information about the wp-hackers
mailing list