Support » Plugin: Infinite Masonry Gallery » Reverse the order

  • Resolved minachu

    (@minachu)


    Hi There,

    Is there a way to reverse the order so that when you upload a new images it becomes the first?
    It’s available on Photography Management, so I thought there might be a part of the js I can change or something.

    Thank you and I hope you can help me.

Viewing 1 replies (of 1 total)
  • Thread Starter minachu

    (@minachu)

    For anyone interested:

    Edit the “edit.bundle.base” JS file and find this code:

    
    {
        key: "handleImageSelect",
        value: function() {
            for (var e = this.state.images, n = t.file_frame.state().get("selection").toJSON(), r = !1, o = 0; o < n.length; o++) "undefined" == typeof n[o].sizes || "undefined" == typeof n[o].sizes.thumbnail ? (r = !0, n[o].imgCallNeeded = !0) : n[o].thumb = n[o].sizes.thumbnail.url;
            for (var i = [], a = 0; a < n.length; a++) {
                for (var l = n[a], s = !1, c = 0; c < e.length; c++) {
                    var u = e[c];
                    u.id == l.id && (s = !0)
                }
                s || (i.push(l.id), e.push(l))
            }
            var p = this;
            r ? b["default"].post(ajaxurl, {
                action: "photo_manage_get_attachment",
                attachID: i
            }, function(t) {
                for (var n = 0; n < t.length; n++) {
                    var r = e.filter(function(e) {
                        return e.id === t[n].id
                    });
                    r.length > 0 && (r[0].thumb = t[n].thumb)
                }
                p.setState({
                    images: e,
                    hasChanged: !0
                })
            }) : p.setState({
                images: e,
                hasChanged: !0
            })
        }
    }
    

    Replace (i.push(l.id), e.push(l)) with (i.unshift(l.id), e.unshift(l))

Viewing 1 replies (of 1 total)
  • The topic ‘Reverse the order’ is closed to new replies.