WordPress Plugin Development - Part 37 - Media Uploader in Custom Widget

Поделиться
HTML-код
  • Опубликовано: 20 янв 2025

Комментарии • 46

  • @ALQAWSI
    @ALQAWSI 3 года назад

    I was watching your tutorials for long time, u r awesome man

  • @krimbelkacem5751
    @krimbelkacem5751 6 лет назад +4

    you are the best wordpress teacher, thank you a lot

  • @CyberIllusions
    @CyberIllusions 6 лет назад +1

    Totally loving it, Alex!! This is WordPress heaven! THX a bunch, Alex!!

    • @alecaddd
      @alecaddd  6 лет назад +1

      You're very welcome :D

  • @khaledsabri9458
    @khaledsabri9458 2 года назад

    can you point me to what modifcations I need to do to use the media selector to input multiple Images ? I have a database table that carries all the images of an entity so it might be 1 image it might be a 100, how can I modify this code to accept multiple images

  • @collinslagat3458
    @collinslagat3458 3 года назад

    This knowledge might get me out of a pickle.

  • @Mythosis
    @Mythosis 6 лет назад +1

    Thanks for the great episodes!. A couple of things the (e) being past is for event not element. eg. event.preventDefault. and I wondered why you didnt target the button using the selector $('.js-image-upload').on('click touch', function() .... also with variable naming conventions the $ is used when the variable is a jQuery Object. Great videos mate thanks!

  • @AndrewWork1
    @AndrewWork1 5 лет назад

    Thanks for the tutorial, this was very helpful. The wordpress codex on wp.media isn't particularly helpful, any ideas on where to go for more information? Specifically, I'm looking for a way to have the media uploader resize the image and only save the resized image. I just put this up on Stack Overflow too.

  • @mateuszkowalik416
    @mateuszkowalik416 6 лет назад +1

    Why save button is disabled after selecting an image? To actually be able to save the changes, we have to type anything in any field text to enable the save button. That's kinda weird

    • @alecaddd
      @alecaddd  6 лет назад +1

      That's WordPress not detecting any changes to the widget. You can overcome this issue by removing the diasbled attribute from the button after the image was picked. You can do that in the javascript file.

    • @iulianburlacu
      @iulianburlacu 6 лет назад

      Im having the same issue , can you pretty please with sugar on top , explain with a little bit more details on how to solve this problem ? . "You can overcome this issue by removing the diasbled attribute from the button after the image was picked. You can do that in the javascript file." I have no "diasbled" attribute on the button in the js file. Thanks. You're awesome.

    • @martimiz
      @martimiz 5 лет назад +3

      This was again a Very Nice Trip through WordPress! Thanks so much Alexander!!! A simple solution to enable the button seems to be triggering a change on the input: button.siblings(".image-upload").val(attachment.url).trigger("change"); Credit goes to wordpress.stackexchange.com/questions/153080/changes-in-widget-customizer-not-triggering-save-and-publish

  • @mathewi2761
    @mathewi2761 6 лет назад +1

    yep, best wp tutorials on youtube

    • @alecaddd
      @alecaddd  6 лет назад

      Thank you so much :D

  • @acerrusm
    @acerrusm 6 лет назад +2

    If you select an image and then click on 'Save' button the widget will be refreshed, which will break the 'click' event binding from the 'Select image' button. So you will not be able to open the media uploader again till you refresh the admin page. Setting 'customize_selective_refresh = false' will not help.
    PS. Thanks A LOT for the giant work that you're doing!

    • @alecaddd
      @alecaddd  6 лет назад

      Mh, interesting, I didn't notice this behaviour, and sorry for the issue.
      Thanks for watching

    • @rajibchisim5357
      @rajibchisim5357 4 года назад

      Thanks #Alecad for this great series. learned a lot from this series. While following the tutorials just stepped on this issue. Problem is related to widget lifecycle and Found a solution here: wordpress.stackexchange.com/questions/91455/how-do-i-rebind-event-after-widget-save

  • @MrMtzr
    @MrMtzr 4 года назад

    Any way I could get my scss files to affect the widget on the frontpage? So far, it doesn't seem to work. Only applies to widget on the Dashboard

  • @maxeminem777
    @maxeminem777 6 лет назад +1

    Thank you for another great tutorial, have a good one :)

  • @eslamzanaty7646
    @eslamzanaty7646 6 лет назад +1

    Hi alex ... Thanks for your effort in your courses i really appreciate it
    I just finished WP 101 and i will go to Sunset series but i inquiry what we will build excatly in this Plugin development series .. I try to understand but nothing ... Thanks alot bro for every thing and keep going

    • @alecaddd
      @alecaddd  6 лет назад +1

      This plugin series is a bit more advanced and it's based on OOP, it's normal to not grasp it the first time, but you'll get there.
      Keep watching my videos and you'll learn everything you need.
      Happy Coding!

    • @eslamzanaty7646
      @eslamzanaty7646 6 лет назад

      Alessandro Castellani i mean what the plugin we will build ?

    • @alecaddd
      @alecaddd  6 лет назад +1

      Oh, sorry :D
      Not a specific plugin, but a massive collection of multiple features that can be activated from within the plugin.
      So far we built a CPT manager, Taxonomy Manager, Custom Widgets, and we'll continue with more awesome stuff.

  • @krimbelkacem5751
    @krimbelkacem5751 6 лет назад

    hi on this tutorial, i know that you saw a problem after selecting the image you needed to change the image url to activate the save button. i think you did not select the right event in js

    • @alecaddd
      @alecaddd  6 лет назад

      Can you provide a code example to corroborate your statement?
      What did I do wrong?

  • @dast6915
    @dast6915 6 лет назад

    Excellent as usual; I have learnt so much from your tutorials. However, in my copy of your code if I select a new image this does not trigger the save button in the widget form. The button will show save if I edit the input field directly. I don't know what is happening yet, but will have to look at it later this evening. I thank you once again for your brilliant tutorials.

    • @alecaddd
      @alecaddd  6 лет назад

      Yeah, that happens to me too.
      You could simply remove the disabled attribute of the button in jQuery when you select an image. That should be an easy workaround.

    • @aloha276
      @aloha276 3 года назад +1

      Or just trigger a change event like this:
      $button.siblings('.image-upload').change();

  • @steeevio5203
    @steeevio5203 6 лет назад

    Hi, thanks for the tutorial. I have been using this method but recently it stopped working, maybe because of a wordpress update. I think that file_frame.on('select', function... no longer works. Have you come across this issue?

    • @steeevio5203
      @steeevio5203 6 лет назад +1

      I think I have it. I used to use the selector text: meta_image.button which it seems no longer works. I should just follow your examples!

    • @alecaddd
      @alecaddd  6 лет назад

      Ehehe, well, yeah :D
      If you're following a tutorial, better not using your own methods because if something doesn't work it gets pretty hard to troubleshoot. Happy Coding

  • @tarekbouzidi6359
    @tarekbouzidi6359 6 лет назад +1

    Thanks from Algeria

    • @alecaddd
      @alecaddd  6 лет назад

      You're very welcome, from Canada :D

  • @shrijantripathi
    @shrijantripathi 6 лет назад +1

    Thanks sir 😊

  • @goImran
    @goImran 6 лет назад +1

    Nice video.

  • @pedramghanbari703
    @pedramghanbari703 5 лет назад +1

    tanks

  • @stpengineering
    @stpengineering 6 лет назад

    Riusciamo a raggiungere questo risultato autonomamente?
    i.postimg.cc/yYkSX3rd/Cattura.jpg
    ty

    • @alecaddd
      @alecaddd  6 лет назад +1

      Mh, si, se non sbaglio quello e' il risultato che andremo ad ottenere.
      Non mi ricordo al 100% 😅

  • @ruipeng1624
    @ruipeng1624 6 лет назад +2

    $button.siblings('.image-upload').val(attachment.url);
    //here
    $('.widget-control-save', '.widget-control-actions').removeAttr('disabled');

    • @vickycampo
      @vickycampo 5 лет назад

      Sorry, can you please explain this. Thank you :D

  • @ruipeng1624
    @ruipeng1624 6 лет назад +1

    Solute from China