95 responses to “How To Integrate the WordPress Media Upload Box Into Your Meta Boxes”

  1. Luke

    Great Dimas! I’ve briefly tested and so far it works like a champ. Very nice work.

  2. leon

    great work Dimas , and great class but media upload have an error with multifields every field take the same value

  3. leon

    thanks Dimas your great .. keep it up

  4. pixenjoy

    Thank you again Dimas,

    I waited this feature for a long time and it will be very useful for everybody i’m sure :-)

    I will test this uploader as soon as possible and give you feedback if i see a bug.

  5. pixenjoy

    I implemented the media upload class to my project by remplacing a simple input file by the uploader. Every things work well in the backoffice. However on the front, my data don’t display anymore.

    Do i need to change something in my template too ?

    The code in my back_metabox.php file:

    setGroupName('img-n'.$mb->get_the_index())->setInsertButtonLabel(__('Insert the url image in the field','aeronef')); ?>
    getField(array('name'=>$mb->get_the_name('imgUrl'),'value'=>$mb->get_the_value('imgUrl'))); ?>
    getButton(); ?>

    The code in my front_template.php file:

    global $custom_metabox_slider;
    $custom_metabox_slider->the_meta();
    ?>
    have_fields('slide')) { ?>

    <img src="the_value('imgUrl'); ?>">

    get_the_value('slideCaption')!='') { ?>

    the_value('slideCaption') ?>

    $custom_metabox_slider->the_value(‘slideCaption’) display but not the image : $custom_metabox_slider->the_value(‘imgUrl’);

  6. pixenjoy

    Sorry, it seems there is some problem with the markup in my prev. comment. My code is not fully displayed ...

  7. pixenjoy

    Hello Dimas,

    This is back_metabox.php (work well)
    https://gist.github.com/913221

    This is front_template.php (baseline display but not imgUrl data)
    https://gist.github.com/913217

    When imgUrl was a simple input field it display.

  8. leon

    bug again Dimas with multifields it’s like duplication error watch this
    goo.gl/7qooY

    and watch this another error
    goo.gl/Oo3Br

    best regards

  9. leon

    @Dimas Confirmed i use WPAlchemy 1.4.5 , release date : 6/4/2011

  10. Dameian

    Hi Dimas!

    Thanks for this. I owe you a few hundred beers and/or teas and/or coffees for making my life 100x easier.

    I wanted to contribute something that I’ve personally found very useful over the past couple of days while building a custom portfolio for a photographer. I found myself longing for the actual attachment ID, plus I wanted to populate a preview area so the client can see the image she just put in her portfolio. So around line 325 of MediaAccess.php I added the following:

    http://pastebin.com/SLWhkbnm

    Hopefully others will find this equally useful since it opens a whole new level of media management goodness via AJAX and the various built-in WP image manipulation functions.

    Cheers!

  11. pixenjoy

    Dimas,

    Yes, i see an imgUrl value in my wp_metadata table. This is a phpmyadmin screenshot of what i see in the meta_value field : http://www.pixenjoy.com/documents/screenshot.png

  12. leon

    any solution for my problem ?

  13. pixenjoy

    I put the var_dump() just before the “while” as you can see here : https://gist.github.com/913217

    And yes, i’ve got some output … imgUrl is in there : http://www.pixenjoy.com/documents/screenshot2.png

  14. pixenjoy
  15. Dameian

    For anyone using WP Alchemy + the media uploader helper to on custom post types… I just wanted to mention this in case someone else hits the same wall I just did:

    If using custom post types and you do not have/want/need the visual editor capability enabled for that custom post type, you will lose the the ability to insert uploaded images. The button in the media manager window simply won’t be there for images uploaded through your custom post type.

    To get around this, what you can do is enable the editor capability when setting up the custom post type, then just add this to a css file that only loads when editing that particular post type:

    #postdivrich {
    display: none;
    }

    Not ideal, but it works.

    This may also be useful. Here is the conditional code I use to limit the loading of css to my custom post type editing page(s) so you don’t make every visual editor disappear:

    http://pastebin.com/3crj3027

  16. leon

    @Dameian in the WpALchemy it’s attr call hide_editor if you set it true the editor will gone and the insert button will come :)

  17. Dameian

    @leon Hah! Yeah. I had a bit of a headsmacking moment last night when I ran across that while looking through all the functions for something unrelated.

  18. pixenjoy

    I’ve found the bug ! Your code is ok Dimas, the error was in my script.
    Sorry to wasted your time.

1 2 3 4

Leave a Reply