Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am working on a theme where I would like users to be able to select pages to show in the theme options page much like Thesis.

I've been Googling / reverse engineering Thesis for a couple hours but haven't found a great solution. I am wondering if anyone has done this or has seen a tutorial.

alt text

share|improve this question
add comment

2 Answers

This is how I do it in a custom theme:

<h3>Select pages to include in menu:</h3>

<p>
<?php
$page_ids = get_all_page_ids();
$current_selected = get_option("pages_to_include");

foreach( $page_ids as $page_id ) {
    if( get_post_status( $page_id ) == 'publish' ) {
        $checked = ( !empty( $current_selected ) && in_array( $page_id, $current_selected ) ) ? ' checked="checked"' : '';
        echo '<input type="checkbox" name="page_to_include[]" id="page-' . $page_id . '" value="' . $page_id . '"' . $checked . ' /> <label for="page-' . $page_id . '">' . get_the_title( $page_id ) . '</label><br />';
    }
}
?>
</p>

You store the pages list in an option (here is "pages_to_include").

share|improve this answer
    
Excellent I'll give it a shot! –  abrudtkuhl Oct 3 '10 at 17:35
    
You are welcome! –  sorich87 Oct 3 '10 at 18:44
add comment

Since WordPress 3.0 there has been a custom menu feature, does that fit your needs? Or something in it that doesn't fit your needs? See Appearance Menus SubPanel in the WordPress codex

share|improve this answer
    
I need this functionality in an admin options page so the user can select pages to include in a slider –  abrudtkuhl Oct 5 '10 at 13:18
    
Doesn't custom menus do this, minus the fact that it will always be under Appearance > Menus (to be honest I have not used them yet)? I'd assume it's better to not reinvent the wheel if not needed as users should be looking there for customizing a menu (if your target is WordPress 3.0 or newer). –  mtekk Oct 6 '10 at 0:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.