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'd like to add a second custom Wordpress image uploader to the WP admin panel sidebar that will upload images to a specific directory. To be more specific I am designing a custom theme for a client and I have set up a custom Nivo Slider with a custom PHP function in the #slider div that pulls all images from a certain directory i.e. /wp-content/themes/my-theme/images/slider and displays them in the Nivo slider. How would I create a panel in the admin panel menu bar that would allow my client to upload new images to /wp-content/themes/my-theme/images/slider?

Thanks y'all!

JWinton

share|improve this question
    
Why not use a Custom Post Type and the Featured Image option to control your images? –  Matthew Muro Feb 29 '12 at 21:59
    
Theme directory should not be used for file storage, since things like update will overwrite it and erase extra files. –  Rarst Nov 17 '12 at 20:40
add comment

1 Answer

I think it's not necessary to use a theme folder to hold some slider pictures.

You can use a post or a page to be the "gallery holder" (it can even be left as draft), and pull its image attachments like this:

function getSimpleGal($id){

    $results = get_children( array(
        'post_parent' => $id, 
        'post_status' => 'inherit', 
        'post_type' => 'attachment', 
        'post_mime_type' => 'image', 
        'order' => 'ASC', 
        'orderby' => 'menu_order ID') );

    foreach ( $results as $image ) {

        // instead of "full", use your custom image size
        $attachmentimage=wp_get_attachment_image_src( $image->ID, "full" );

        echo '<img src="'.$attachmentimage[0].'" title="'.$image->post_title.'" width="'.$attachmentimage[1].'" height="'.$attachmentimage[2].'" />';

    }
}
share|improve this answer
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.