3

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

2
  • Why not use a Custom Post Type and the Featured Image option to control your images? Commented Feb 29, 2012 at 21:59
  • Theme directory should not be used for file storage, since things like update will overwrite it and erase extra files.
    – Rarst
    Commented Nov 17, 2012 at 20:40

1 Answer 1

1

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].'" />';

    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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