gambitph / Titan-Framework

The easiest to use WordPress option framework.
http://www.titanframework.net
377 stars 137 forks source link

Gallery Option #383

Open mathieupreaud opened 7 years ago

mathieupreaud commented 7 years ago

Hi,

I just tried for the first time the Gallery option and I'm facing to a problem. When I upload the second image, it always deletes the first one and takes its position.

Anyone found out how to resolve this issue?

I'm using the last version of TF (1.11) and WP (4.7).

Thank you!

mathieupreaud commented 7 years ago

Anyone can confirm this issue?

msoal-design commented 7 years ago

Its happening with me too. Wordpress 4.7.5 and Titan 1.11

amin3d commented 6 years ago

In the name of Allah, I fix the problem:: put this code in class-option-gallery.php which is in lib folder. the best place for putting your code is line 148::

` frame.on('open',function() {

                var selection = frame.state().get('selection');
                if(_input.val()!="")
                {
                    var ids = _input.val().split(',');
                    ids.forEach(function(id) {
                        var attachment = wp.media.attachment(id);
                        attachment.fetch();
                        selection.add( attachment ? [ attachment ] : [] );
                    });
                }

            });`
emadelawady commented 6 years ago

it works now, just try is carefully to understand how it works , dont add new code

== when you set-up your type to "gallery" , just go in meta-box in admin panel and test it by add multi images

notes to make it works

you should now see the three images is there, i'm working now on how to display images in the front