[wp-hackers] Front Page Displays - WordPress 2.5

Lew Ayotte wordpress at redfootwebdesign.com
Mon Apr 7 15:27:47 GMT 2008


I think this is exactly what I want... thanks for the tip!

Lew

On Sun, Apr 6, 2008 at 12:20 PM, Aaron Harun <admin at anthologyoi.com> wrote:

> 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;
>
> }?>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list