Post Grid - Version 2.0.65

Version Description

  • 2020-06-04 add - Ignore paged/page variable from query to display same posts on paginated page.
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Post Grid
Version 2.0.65
Comparing to
See all releases

Code changes from version 2.0.64 to 2.0.65

assets/frontend/js/layout-builder.js CHANGED
@@ -5,10 +5,10 @@
5
  * */
6
  editorSettings = {
7
  activeTab: 0,
8
- selectedElement: {path:[], elType: ''},
9
- selectedPath: '',
10
- selectedelType: '',
11
- breakpoints:{mobile:'576px', tablet:'992px', desktop:'1200px'}
12
 
13
  }
14
 
@@ -18,6 +18,10 @@ toolsToggle = document.querySelectorAll('.tools-toggle');
18
  templatePreview = document.getElementById('template-preview');
19
  codeDisplay = document.getElementById('codeDisplay');
20
  selectedObjectSettings = document.getElementById('selectedObjectSettings');
 
 
 
 
21
 
22
 
23
 
@@ -26,14 +30,11 @@ tools_tabs_switch(editorSettings);
26
  function tools_tabs_switch(editorSettings){
27
  activeTab = editorSettings.activeTab;
28
 
29
- console.log('activeTab');
30
- console.log(activeTab);
31
 
32
  i = 0;
33
  tabNavs.forEach((tabNav) => {
34
  content = tabsContent[i]
35
 
36
- //console.log(content);
37
  tabNav.classList.remove("active");
38
  tabNav.classList.remove("inactive");
39
 
@@ -57,7 +58,70 @@ function tools_tabs_switch(editorSettings){
57
 
58
  }
59
 
 
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  // Listen click event for tabs
63
 
@@ -114,224 +178,96 @@ toolsToggle.forEach((toggle) => {
114
 
115
 
116
 
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
  templateData = [
125
  {
126
- elType: "container",
127
- elName: "Container 1",
128
- class: "pglb-container container p-1 m-1",
129
- id: "",
130
- isActive: false,
131
  children: [
132
  {
133
- elType: "row",
134
- elName: "row 11",
135
- class: "pglb-row row p-1 m-1",
136
  id: "",
137
  isActive: false,
138
- children: [
139
- {
140
- elType: "column",
141
- elName: "column 111",
142
- class: "pglb-column col p-1 m-1",
143
- id: "",
144
- isActive: false,
145
- children: [
146
- {
147
- elType: "text",
148
- elName: "Text 111",
149
- class: "pglb-text pglb-element text p-1 m-1",
150
- id: "",
151
- isActive: false,
152
- innerHtml: "111 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
153
- children: [],
154
- }
155
- ],
156
- },
157
- {
158
- elType: "column",
159
- elName: "column 112",
160
- class: "pglb-column col p-1 m-1",
161
- id: "",
162
- isActive: false,
163
- children: [
164
- {
165
- elType: "text",
166
- elName: "Text 112",
167
- class: "pglb-text pglb-element text p-1 m-1",
168
- id: "",
169
- isActive: false,
170
- innerHtml: "112 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
171
- children: [],
172
- }
173
- ],
174
- },
175
- {
176
- elType: "column",
177
- elName: "column 113",
178
- class: "pglb-column col p-1 m-1",
179
- id: "",
180
- isActive: false,
181
- children: [
182
- {
183
- elType: "text",
184
- elName: "Text 113",
185
- class: "pglb-text pglb-element text p-1 m-1",
186
- id: "",
187
- isActive: false,
188
- innerHtml: "113 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
189
- children: [],
190
- }
191
- ],
192
- },
193
-
194
 
195
- ],
196
- }],
197
- },
198
- {
199
- elType: "container",
200
- elName: "Container 2",
201
- class: "pglb-container container p-1 m-1",
202
- id: "",
203
- isActive: false,
204
- children: [
205
  {
206
- elType: "row",
207
- elName: "row 21",
208
- class: "pglb-row row p-1 m-1",
209
  id: "",
210
  isActive: false,
211
  children: [
212
  {
213
- elType: "column",
214
- elName: "column 211",
215
- class: "pglb-column col p-1 m-1",
216
- id: "",
217
- isActive: false,
218
- children: [
219
- {
220
- elType: "text",
221
- elName: "Text 211",
222
- class: "pglb-text pglb-element text p-1 m-1",
223
- id: "",
224
- isActive: false,
225
- innerHtml: "211 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
226
- children: [],
227
- }
228
- ],
229
- },
230
- {
231
- elType: "column",
232
- elName: "column 212",
233
- class: "pglb-column col p-1 m-1",
234
- id: "",
235
- isActive: false,
236
- children: [
237
- {
238
- elType: "text",
239
- elName: "Text 212",
240
- class: "pglb-text pglb-element text p-1 m-1",
241
- id: "",
242
- isActive: false,
243
- innerHtml: "212 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
244
- children: [],
245
- }
246
- ],
247
- },
248
- {
249
- elType: "column",
250
- elName: "column 213",
251
- class: "pglb-column col p-1 m-1",
252
  id: "",
253
  isActive: false,
254
- children: [
255
- {
256
- elType: "text",
257
- elName: "Text 213",
258
- class: "pglb-text pglb-element text p-1 m-1",
259
- id: "",
260
- isActive: false,
261
- innerHtml: "213 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
262
- children: [],
263
- }
264
- ],
265
  },
266
 
267
-
268
  ],
269
- }],
270
- },
271
- {
272
- elType: "container",
273
- elName: "Container 3",
274
- class: "pglb-container container p-1 m-1",
275
- id: "",
276
- isActive: false,
277
- children: [
278
  {
279
  elType: "row",
280
- elName: "row 31",
281
  class: "pglb-row row p-1 m-1",
282
  id: "",
283
  isActive: false,
284
  children: [
285
  {
286
  elType: "column",
287
- elName: "column 311",
288
  class: "pglb-column col p-1 m-1",
289
  id: "",
290
  isActive: false,
291
  children: [
292
  {
293
  elType: "text",
294
- elName: "Text 311",
295
  class: "pglb-text pglb-element text p-1 m-1",
296
  id: "",
297
  isActive: false,
298
- innerHtml: "311 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
299
  children: [],
300
- }
 
301
  ],
302
  },
303
  {
304
  elType: "column",
305
- elName: "column 312",
306
  class: "pglb-column col p-1 m-1",
307
  id: "",
308
  isActive: false,
309
  children: [
310
  {
311
  elType: "text",
312
- elName: "Text 312",
313
  class: "pglb-text pglb-element text p-1 m-1",
314
  id: "",
315
  isActive: false,
316
- innerHtml: "312 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
317
  children: [],
318
  }
319
  ],
320
  },
321
  {
322
  elType: "column",
323
- elName: "column 313",
324
  class: "pglb-column col p-1 m-1",
325
  id: "",
326
  isActive: false,
327
  children: [
328
  {
329
  elType: "text",
330
- elName: "Text 313",
331
  class: "pglb-text pglb-element text p-1 m-1",
332
  id: "",
333
  isActive: false,
334
- innerHtml: "313 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
335
  children: [],
336
  }
337
  ],
@@ -339,18 +275,94 @@ templateData = [
339
 
340
 
341
  ],
342
- }],
343
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
 
345
 
346
 
347
- ];
348
 
349
 
350
  elementsData = {
351
  container:{
352
  elType: "container",
353
- elName: "Container 2",
354
  class: "pglb-container container",
355
  id: "",
356
  isActive: false,
@@ -358,7 +370,6 @@ elementsData = {
358
  },
359
  row:{
360
  elType: "row",
361
- elName: "row 21",
362
  class: "pglb-row row p-1 m-1",
363
  id: "",
364
  isActive: false,
@@ -366,7 +377,6 @@ elementsData = {
366
  },
367
  column:{
368
  elType: "column",
369
- elName: "column 211",
370
  class: "pglb-column col p-1 m-1",
371
  id: "",
372
  isActive: false,
@@ -374,7 +384,6 @@ elementsData = {
374
  },
375
  heading:{
376
  elType: "heading",
377
- elName: "heading 211",
378
  class: "pglb-heading pglb-element p-1 m-1",
379
  id: "",
380
  isActive: false,
@@ -398,9 +407,17 @@ elementsData = {
398
  },
399
  children: [],
400
  },
 
 
 
 
 
 
 
 
 
401
  text:{
402
  elType: "text",
403
- elName: "text 211",
404
  class: "pglb-text pglb-element p-1 m-1",
405
  id: "",
406
  isActive: false,
@@ -426,7 +443,6 @@ elementsData = {
426
 
427
  emptyRow:{
428
  elType: "emptyRow",
429
- elName: "empty 211",
430
  class: "pglb-empty text-center w-100 p-1 m-1",
431
  id: "",
432
  isActive: false,
@@ -435,7 +451,6 @@ elementsData = {
435
  },
436
  emptyColumn:{
437
  elType: "emptyColumn",
438
- elName: "empty 211",
439
  class: "pglb-empty text-center w-100 p-1 m-1",
440
  id: "",
441
  isActive: false,
@@ -445,7 +460,6 @@ elementsData = {
445
 
446
  empty:{
447
  elType: "empty",
448
- elName: "empty 211",
449
  class: "pglb-empty text-center w-100 p-1 m-1",
450
  id: "",
451
  isActive: false,
@@ -455,7 +469,6 @@ elementsData = {
455
 
456
  link:{
457
  elType: "link",
458
- elName: "link 211",
459
  class: "pglb-link pglb-element p-1 m-1",
460
  id: "",
461
  isActive: false,
@@ -482,11 +495,10 @@ elementsData = {
482
  },
483
  image:{
484
  elType: "image",
485
- elName: "image 211",
486
  class: "pglb-image pglb-element p-1 m-1",
487
  id: "",
488
  isActive: false,
489
- src: 'https://i.imgur.com/QheX3ut.jpg',
490
  style:{
491
  width: {'576px': '', '992px': '', '1200px': ''},
492
  height: {'576px': '', '992px': '', '1200px': ''},
@@ -499,47 +511,120 @@ elementsData = {
499
 
500
  }
501
 
 
502
 
 
503
 
 
504
 
 
505
 
 
506
 
 
 
 
507
 
508
- function elTreeView(data) {
 
 
509
 
 
510
 
511
- selectedPath = (editorSettings.selectedPath.length != 0) ? editorSettings.selectedPath : [0,0,0];
512
 
513
- //console.log(selectedPath);
514
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  html = '';
516
 
517
- for (var index in data){
518
 
519
- element = data[index];
520
- elName = (element.elName !== 'undefined') ? element.elName : '';
521
- elType = (element.elType) ? element.elType : '';
522
 
 
 
 
 
523
 
524
- children = element.children;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
525
  element.index = index;
526
  element.id = elType+"-"+index;
527
- element.isActive = (selectedPath[0] == index) ? true : false;
 
 
528
 
529
 
530
 
531
  args = {};
532
 
533
- //console.log(elType+": "+ index);
 
 
 
 
 
 
 
 
 
534
 
535
  html += elementStartTag(element);
536
 
537
  if(children.length > 0){
538
 
539
  selectedPath.splice(0,1);
540
- //console.log(selectedPath);
541
  args.selectedPath = selectedPath;
542
 
 
543
  generateChildHtml(children, args);
544
  }
545
  html += elementEndTag(element);
@@ -549,6 +634,8 @@ function elTreeView(data) {
549
 
550
 
551
 
 
 
552
  return html;
553
 
554
 
@@ -562,25 +649,30 @@ function generateChildHtml(data, args){
562
 
563
  for (var index in data){
564
  element = data[index];
565
- elName = element.elName;
566
  elType = element.elType;
567
  id = element.id;
 
568
  selectedPath = args.selectedPath;
 
569
 
570
- //console.log(selectedPath);
 
571
 
572
- element.isActive = (selectedPath[0] == index) ? true : false;
 
 
 
 
 
573
 
574
 
575
- children = element.children;
576
 
577
- element.id = (id) ? id : '';
578
- element.index = index;
579
 
580
 
581
  html += elementStartTag(element);
582
 
583
  if( children.length > 0){
 
584
  generateChildHtml(children, args);
585
  }
586
 
@@ -686,17 +778,18 @@ function generateElHtmlcontainer(element){
686
  elId = element.id;
687
  elClass = element.class;
688
  elType = element.elType;
689
- isActive = element.isActive;
690
- isActiveClass = (isActive) ? 'active' : '';
691
 
692
  index = element.index;
693
  children = (children.length != 0) ? element.children : [elementsData.emptyRow];
694
 
695
 
 
 
 
696
 
697
- //console.log(index);
698
 
699
- html += '<div isActive="'+isActiveClass+'" index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
700
  html += '<div class="containerSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement"><i class="fas fa-check"></i></span><span onclick="removeElement(this, event )" class="remove"><i class="fas fa-times"></i></span></div>';
701
 
702
  // html += '{{el_container}}';
@@ -718,6 +811,8 @@ function generateElHtmlrow(element){
718
  elType = element.elType;
719
  index = element.index;
720
 
 
 
721
  children = (children.length != 0) ? element.children : [elementsData.emptyColumn];
722
 
723
  html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
@@ -740,6 +835,9 @@ function generateElHtmlcolumn(element){
740
  elId = element.id;
741
  elClass = element.class;
742
  elType = element.elType;
 
 
 
743
  children = (children.length != 0) ? element.children : [elementsData.empty];
744
 
745
 
@@ -747,22 +845,16 @@ function generateElHtmlcolumn(element){
747
 
748
  index = element.index;
749
 
750
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
751
  html += '<div class="columnSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement" ><i class="fas fa-check"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
752
 
753
  if(children.length == 0){
754
  html += '<i class="far fa-plus-square"></i>';
755
  }
756
 
757
-
758
  // html += '{{el_column}}';
759
  // html += '</div>';
760
 
761
-
762
-
763
-
764
-
765
-
766
  return html;
767
 
768
  }
@@ -777,10 +869,12 @@ function generateElHtmltext(element){
777
  innerHtml = element.innerHtml;
778
  index = element.index;
779
 
 
 
780
  children = element.children;
781
 
782
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
783
- html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
784
 
785
  html += innerHtml;
786
  // html += '</div>';
@@ -801,7 +895,9 @@ function generateElHtmlempty(element){
801
 
802
  children = element.children;
803
 
804
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
 
 
805
  html += innerHtml;
806
  // html += '</div>';
807
 
@@ -821,7 +917,9 @@ function generateElHtmlemptyRow(element){
821
 
822
  children = element.children;
823
 
824
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
 
 
825
  html += innerHtml;
826
  // html += '</div>';
827
 
@@ -841,7 +939,9 @@ function generateElHtmlemptyColumn(element){
841
 
842
  children = element.children;
843
 
844
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
 
 
845
  html += innerHtml;
846
  // html += '</div>';
847
 
@@ -872,8 +972,10 @@ function generateElHtmllink(element){
872
 
873
  children = element.children;
874
 
875
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
876
- html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
 
 
877
 
878
  html += '<a target="'+target+'" href="'+href+'">';
879
  html += innerHtml;
@@ -898,8 +1000,12 @@ function generateElHtmlheading(element){
898
 
899
  children = element.children;
900
 
901
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
902
- html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
 
 
 
 
903
  html += '<'+tag+'>';
904
  html += innerHtml;
905
  html += '</'+tag+'>';
@@ -920,8 +1026,11 @@ function generateElHtmlimage(element){
920
  index = element.index;
921
  src = element.src;
922
 
923
- html += '<div id="'+elId+'" index="'+index+'" class="'+elClass+'" elType="'+elType+'">';
924
- html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
 
 
 
925
  html += '<img src="'+src+'" />';
926
  //html += '{{el_text}}';
927
  // html += '</div>';
@@ -933,18 +1042,15 @@ function generateElHtmlimage(element){
933
  }
934
 
935
 
936
- //console.log(templateData);
937
 
938
 
939
 
940
 
941
  function removeElement(currentEl, event){
942
 
943
- //console.log(currentEl);
944
 
945
 
946
  newtemplateData = templateData;
947
- //console.log(newtemplateData);
948
 
949
 
950
  event.stopPropagation();
@@ -956,9 +1062,6 @@ function removeElement(currentEl, event){
956
  elClass = el.getAttribute('class');
957
 
958
 
959
- // console.log(elId);
960
- // console.log(elIndex);
961
- // console.log(elClass);
962
 
963
  var els = [];
964
  var Indexes = [elIndex];
@@ -972,9 +1075,7 @@ function removeElement(currentEl, event){
972
  elIndex = el.getAttribute('index');
973
  elClass = el.getAttribute('class');
974
 
975
- // console.log(elId);
976
- // console.log(elIndex);
977
- // console.log(elClass);
978
 
979
  if(elIndex !== null)
980
  Indexes.push(elIndex);
@@ -996,41 +1097,33 @@ function removeElement(currentEl, event){
996
 
997
  indexCount = Indexes.length;
998
 
999
- //console.log(Indexes);
1000
 
1001
  if(indexCount == 1){
1002
  //delete templateData[Indexes[0]];
1003
  newtemplateData.splice(Indexes[0], 1);
1004
-
1005
  templatePreview.innerHTML = elTreeView(newtemplateData);
1006
 
1007
  }else{
1008
 
1009
- //console.log(Indexes);
1010
 
1011
  containerIndex = Indexes[0];
1012
- //console.log(containerIndex);
1013
- //delete Indexes[0];
1014
  Indexes.splice(0, 1);
1015
 
1016
- // console.log(newtemplateData[containerIndex]);
1017
- // console.log(Indexes);
1018
 
1019
 
1020
  newData = deletetemplateData(Indexes, newtemplateData[containerIndex]);
1021
  templatePreview.innerHTML = elTreeView(newtemplateData);
1022
 
1023
- // console.log(typeof newData);
1024
  //
1025
  // if(typeof newData !== 'undefined' && newData !== null){
1026
- // console.log(newData);
1027
  //
1028
  // templateData[containerIndex] = newData;
1029
  // }
1030
 
1031
  }
1032
 
1033
- //console.log(typeof templateData);
1034
 
1035
 
1036
  }
@@ -1040,29 +1133,17 @@ function removeElement(currentEl, event){
1040
 
1041
  function deletetemplateData(index, data) {
1042
 
1043
- console.log("##################");
1044
-
1045
- console.log(index);
1046
- console.log(data);
1047
-
1048
-
1049
  indexCount = index.length;
1050
 
1051
- // console.log("indexCount");
1052
- // console.log(indexCount);
1053
- // console.log(index[0]);
1054
-
1055
 
1056
  if(indexCount > 1){
1057
 
1058
  newData = data.children[index[0]];
1059
- //console.log(newData);
1060
 
1061
  //delete index[0];
1062
  index.splice(0,1);
1063
 
1064
 
1065
- //console.log(index);
1066
 
1067
  data = deletetemplateData(index, newData);
1068
 
@@ -1071,11 +1152,9 @@ function deletetemplateData(index, data) {
1071
 
1072
  }else{
1073
 
1074
- //delete templateData.children[index[0]];
1075
 
1076
  data.children.splice(index[0], 1);
1077
 
1078
- //console.log(templateData);
1079
 
1080
 
1081
  return data;
@@ -1083,20 +1162,6 @@ function deletetemplateData(index, data) {
1083
 
1084
 
1085
 
1086
- //console.log(templateData);
1087
-
1088
- //delete templateData.children[0].children[1];
1089
-
1090
- //for (i = 0; i<indexCount; i++){
1091
- //if(i > 0){
1092
- //newData = deletetemplateData(index, templateData.children[index[i]]);
1093
- //}
1094
-
1095
- //}
1096
- //delete templateData;
1097
-
1098
-
1099
-
1100
 
1101
  }
1102
 
@@ -1115,7 +1180,6 @@ function generateElementSettings(elType) {
1115
 
1116
  toolsToggle = document.querySelectorAll('.tools-toggle');
1117
 
1118
- console.log(toolsToggle);
1119
 
1120
 
1121
  }
@@ -1123,7 +1187,6 @@ function generateElementSettings(elType) {
1123
 
1124
  function customizeElement(currentEl, event) {
1125
 
1126
- //console.log(currentEl.parentNode);
1127
  editorSettings.activeTab = 1;
1128
  tools_tabs_switch(editorSettings);
1129
 
@@ -1131,21 +1194,64 @@ function customizeElement(currentEl, event) {
1131
  el = currentEl;
1132
  selectElement(currentEl, event);
1133
 
1134
- elType = editorSettings.selectedelType;
1135
  path = editorSettings.selectedElement.path;
1136
 
1137
 
1138
- console.log(elementsData[elType]);
1139
  generateElementSettings(elType);
1140
 
1141
 
1142
  }
1143
 
1144
- function selectElement(currentEl, event){
1145
 
1146
- //console.log(currentEl.parentNode);
1147
 
1148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1149
  event.stopPropagation();
1150
 
1151
  el = currentEl;
@@ -1155,9 +1261,6 @@ function selectElement(currentEl, event){
1155
  elClass = el.getAttribute('class');
1156
 
1157
 
1158
- // console.log(elId);
1159
- // console.log(elIndex);
1160
- // console.log(elClass);
1161
 
1162
  var els = [];
1163
  var Indexes = [elIndex];
@@ -1170,14 +1273,11 @@ function selectElement(currentEl, event){
1170
  elId = el.getAttribute('id');
1171
  elIndex = el.getAttribute('index');
1172
  elClass = el.getAttribute('class');
1173
- //el.setAttribute('isActive','active');
1174
 
1175
- //el.addClass('active');
1176
- //console.log(el);
 
1177
 
1178
- // console.log(elId);
1179
- // console.log(elIndex);
1180
- //console.log(elClass);
1181
 
1182
  if(elIndex !== null)
1183
  Indexes.push(elIndex);
@@ -1196,58 +1296,41 @@ function selectElement(currentEl, event){
1196
  return item != null;
1197
  });
1198
 
1199
- console.log(Indexes);
1200
 
1201
  currentEl.parentNode.parentNode.setAttribute("path", Indexes);
1202
  elType = currentEl.parentNode.parentNode.getAttribute('elType');
1203
 
1204
 
1205
- editorSettings.selectedPath = Indexes;
1206
- editorSettings.selectedelType = elType;
1207
-
1208
  editorSettings.selectedElement.path = Indexes;
1209
  editorSettings.selectedElement.elType = elType;
1210
 
1211
 
1212
- console.log(editorSettings);
1213
- }
1214
 
1215
- function getElementByIndex(index){
1216
-
1217
- }
1218
 
 
1219
 
1220
- function addElement(event, element ){
1221
 
1222
- event.stopPropagation();
1223
 
1224
- var elType = element.elType;
1225
 
1226
- //console.log(element);
1227
- //console.log(elementsData[elType]);
1228
 
 
1229
 
 
1230
 
 
1231
 
1232
 
1233
  selectedElement = editorSettings.selectedElement;
1234
- //console.log(selectedElement.path);
1235
 
1236
 
1237
  selectedelType = (selectedElement.elType) ? selectedElement.elType : 'container';
1238
  selectedPath = (selectedElement.path.length != 0) ? selectedElement.path : ["0"];
1239
 
1240
-
1241
- // console.log('elType: '+elType);
1242
- //
1243
- // console.log('selectedelType: '+selectedelType);
1244
- // console.log('selectedPath: ');
1245
- // console.log(selectedPath);
1246
-
1247
-
1248
- // console.log(templateData);
1249
- // console.log(templateData);
1250
-
1251
  if(selectedelType == 'container'){
1252
 
1253
  if(elType == 'container'){
@@ -1258,7 +1341,6 @@ function addElement(event, element ){
1258
  containerIndex = selectedPath[0];
1259
  rowIndex = selectedPath[1];
1260
 
1261
- //console.log(templateData[containerIndex]);
1262
 
1263
  templateData[containerIndex].children.push(elementsData[elType]);
1264
 
@@ -1308,8 +1390,6 @@ function addElement(event, element ){
1308
  containerIndex = selectedPath[0];
1309
  rowIndex = selectedPath[1];
1310
 
1311
- //console.log(templateData[containerIndex]);
1312
-
1313
  templateData[containerIndex].children.push(elementsData[elType]);
1314
 
1315
 
@@ -1339,7 +1419,6 @@ function addElement(event, element ){
1339
 
1340
  }
1341
 
1342
- //console.log(templateData);
1343
  templatePreview.innerHTML = elTreeView(templateData);
1344
 
1345
 
5
  * */
6
  editorSettings = {
7
  activeTab: 0,
8
+ selectedElement: {path:[], elType: '', data: []},
9
+ breakpoints:{mobile:'576px', tablet:'992px', desktop:'1200px'},
10
+ editElementData: [],
11
+ elementTree:[],
12
 
13
  }
14
 
18
  templatePreview = document.getElementById('template-preview');
19
  codeDisplay = document.getElementById('codeDisplay');
20
  selectedObjectSettings = document.getElementById('selectedObjectSettings');
21
+ elementTreeWrap = document.getElementById('tree-list');
22
+ searchElement = document.getElementById('searchElement');
23
+ elementListWrap = document.getElementById('elementListWrap');
24
+ searchResults = document.getElementById('searchResults');
25
 
26
 
27
 
30
  function tools_tabs_switch(editorSettings){
31
  activeTab = editorSettings.activeTab;
32
 
 
 
33
 
34
  i = 0;
35
  tabNavs.forEach((tabNav) => {
36
  content = tabsContent[i]
37
 
 
38
  tabNav.classList.remove("active");
39
  tabNav.classList.remove("inactive");
40
 
58
 
59
  }
60
 
61
+ searchElement.addEventListener('keyup', () => {
62
 
63
+ keyword = searchElement.value.toLowerCase();
64
+ //console.log(typeof keyword);
65
+ results = [];
66
+
67
+ if(keyword.length > 0){
68
+
69
+
70
+ toolsToggle = document.querySelectorAll('#elementListWrap > .tools-toggle');
71
+ toolsToggle.forEach((item) => {
72
+
73
+ elementList = item.children[1].children[0];
74
+ elements = elementList.children;
75
+
76
+ //console.log(typeof elements);
77
+
78
+ for(index in elements){
79
+ element = elements[index];
80
+
81
+ if(typeof(element.innerText) == 'string'){
82
+ elName = element.innerText.toLowerCase();
83
+
84
+ n = elName.indexOf(keyword);
85
+ if(n<0){
86
+
87
+ }else{
88
+
89
+ results.push(element);
90
+ }
91
+
92
+ }
93
+
94
+ }
95
+
96
+ })
97
+
98
+
99
+ for(i in results){
100
+
101
+ item = results[i];
102
+
103
+ searchResults.append(item);
104
+ }
105
+
106
+ //searchResults
107
+
108
+
109
+ //console.log(results);
110
+
111
+ searchResults.style.display = 'block';
112
+
113
+ }else{
114
+
115
+ searchResults.innerHTML = '';
116
+ searchResults.style.display = 'none';
117
+ }
118
+
119
+
120
+
121
+
122
+
123
+
124
+ });
125
 
126
  // Listen click event for tabs
127
 
178
 
179
 
180
 
 
 
 
 
 
 
 
181
  templateData = [
182
  {
 
 
 
 
 
183
  children: [
184
  {
185
+ elType: "text",
186
+ elName: "Text",
187
+ class: "pglb-text pglb-element text p-1 m-1",
188
  id: "",
189
  isActive: false,
190
+ innerHtml: "0 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
191
+ children: [],
192
+ },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
 
 
 
 
 
 
 
 
 
 
194
  {
195
+ elType: "column",
196
+ elName: "Column",
197
+ class: "pglb-column col p-1 m-1",
198
  id: "",
199
  isActive: false,
200
  children: [
201
  {
202
+ elType: "text",
203
+ elName: "Text",
204
+ class: "pglb-text pglb-element text p-1 m-1",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  id: "",
206
  isActive: false,
207
+ innerHtml: "20 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
208
+ children: [],
 
 
 
 
 
 
 
 
 
209
  },
210
 
 
211
  ],
212
+ },
 
 
 
 
 
 
 
 
213
  {
214
  elType: "row",
215
+ elName: "Row",
216
  class: "pglb-row row p-1 m-1",
217
  id: "",
218
  isActive: false,
219
  children: [
220
  {
221
  elType: "column",
222
+ elName: "Column",
223
  class: "pglb-column col p-1 m-1",
224
  id: "",
225
  isActive: false,
226
  children: [
227
  {
228
  elType: "text",
229
+ elName: "Text",
230
  class: "pglb-text pglb-element text p-1 m-1",
231
  id: "",
232
  isActive: false,
233
+ innerHtml: "300 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
234
  children: [],
235
+ },
236
+
237
  ],
238
  },
239
  {
240
  elType: "column",
241
+ elName: "Column",
242
  class: "pglb-column col p-1 m-1",
243
  id: "",
244
  isActive: false,
245
  children: [
246
  {
247
  elType: "text",
248
+ elName: "Text",
249
  class: "pglb-text pglb-element text p-1 m-1",
250
  id: "",
251
  isActive: false,
252
+ innerHtml: "310 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
253
  children: [],
254
  }
255
  ],
256
  },
257
  {
258
  elType: "column",
259
+ elName: "Column",
260
  class: "pglb-column col p-1 m-1",
261
  id: "",
262
  isActive: false,
263
  children: [
264
  {
265
  elType: "text",
266
+ elName: "Text",
267
  class: "pglb-text pglb-element text p-1 m-1",
268
  id: "",
269
  isActive: false,
270
+ innerHtml: "320 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
271
  children: [],
272
  }
273
  ],
275
 
276
 
277
  ],
278
+ },
279
+ {
280
+ elType: "container",
281
+ class: "pglb-container container",
282
+ id: "",
283
+ elName: "Container",
284
+ isActive: false,
285
+ children: [
286
+ {
287
+ elType: "row",
288
+ elName: "Row",
289
+ class: "pglb-row row p-1 m-1",
290
+ id: "",
291
+ isActive: false,
292
+ children: [
293
+ {
294
+ elType: "column",
295
+ elName: "Column",
296
+ class: "pglb-column col p-1 m-1",
297
+ id: "",
298
+ isActive: false,
299
+ children: [
300
+ {
301
+ elType: "text",
302
+ elName: "Text",
303
+ class: "pglb-text pglb-element text p-1 m-1",
304
+ id: "",
305
+ isActive: false,
306
+ innerHtml: "300 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
307
+ children: [],
308
+ },
309
+
310
+ ],
311
+ },
312
+ {
313
+ elType: "column",
314
+ elName: "Column",
315
+ class: "pglb-column col p-1 m-1",
316
+ id: "",
317
+ isActive: false,
318
+ children: [
319
+ {
320
+ elType: "text",
321
+ elName: "Text",
322
+ class: "pglb-text pglb-element text p-1 m-1",
323
+ id: "",
324
+ isActive: false,
325
+ innerHtml: "310 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
326
+ children: [],
327
+ }
328
+ ],
329
+ },
330
+ {
331
+ elType: "column",
332
+ elName: "Column",
333
+ class: "pglb-column col p-1 m-1",
334
+ id: "",
335
+ isActive: false,
336
+ children: [
337
+ {
338
+ elType: "text",
339
+ elName: "Text",
340
+ class: "pglb-text pglb-element text p-1 m-1",
341
+ id: "",
342
+ isActive: false,
343
+ innerHtml: "320 The paragraph element is the default element type. It should not have any alignment of any kind. It should just flow like you would normally expect. Nothing fancy. Just straight up text, free flowing, with love.",
344
+ children: [],
345
+ }
346
+ ],
347
+ },
348
+
349
+
350
+ ],
351
+ },
352
+ ],
353
+ },
354
+ ]
355
+ }
356
+ ]
357
+
358
 
359
 
360
 
 
361
 
362
 
363
  elementsData = {
364
  container:{
365
  elType: "container",
 
366
  class: "pglb-container container",
367
  id: "",
368
  isActive: false,
370
  },
371
  row:{
372
  elType: "row",
 
373
  class: "pglb-row row p-1 m-1",
374
  id: "",
375
  isActive: false,
377
  },
378
  column:{
379
  elType: "column",
 
380
  class: "pglb-column col p-1 m-1",
381
  id: "",
382
  isActive: false,
384
  },
385
  heading:{
386
  elType: "heading",
 
387
  class: "pglb-heading pglb-element p-1 m-1",
388
  id: "",
389
  isActive: false,
407
  },
408
  children: [],
409
  },
410
+ div:{
411
+ elType: "div",
412
+ class: "pglb-div pglb-element p-1 m-1",
413
+ id: "",
414
+ isActive: false,
415
+ innerHtml: 'Div element',
416
+ children: [],
417
+ },
418
+
419
  text:{
420
  elType: "text",
 
421
  class: "pglb-text pglb-element p-1 m-1",
422
  id: "",
423
  isActive: false,
443
 
444
  emptyRow:{
445
  elType: "emptyRow",
 
446
  class: "pglb-empty text-center w-100 p-1 m-1",
447
  id: "",
448
  isActive: false,
451
  },
452
  emptyColumn:{
453
  elType: "emptyColumn",
 
454
  class: "pglb-empty text-center w-100 p-1 m-1",
455
  id: "",
456
  isActive: false,
460
 
461
  empty:{
462
  elType: "empty",
 
463
  class: "pglb-empty text-center w-100 p-1 m-1",
464
  id: "",
465
  isActive: false,
469
 
470
  link:{
471
  elType: "link",
 
472
  class: "pglb-link pglb-element p-1 m-1",
473
  id: "",
474
  isActive: false,
495
  },
496
  image:{
497
  elType: "image",
 
498
  class: "pglb-image pglb-element p-1 m-1",
499
  id: "",
500
  isActive: false,
501
+ src: 'http://localhost/wp/wp-content/uploads/2018/11/Untitled-1.png',
502
  style:{
503
  width: {'576px': '', '992px': '', '1200px': ''},
504
  height: {'576px': '', '992px': '', '1200px': ''},
511
 
512
  }
513
 
514
+ html = '';
515
 
516
+ function elementTree(templateData, elementTreeList) {
517
 
518
+ count = 0;
519
 
520
+ html += '<ul>';
521
 
522
+ for (var index in templateData){
523
 
524
+ element = templateData[index];
525
+ elType = (element.elType) ? element.elType : '';
526
+ elName = (element.elName) ? element.elName : '';
527
 
528
+ children = element.children;
529
+ html += '<li>';
530
+ html += '<span>'+elName+'</span>';
531
 
532
+ elementTreeList.push([index, elName]);
533
 
534
+ //console.log(elementTreeList);
535
 
 
536
 
537
+
538
+ if(children.length > 0){
539
+ elementTree(children, elementTreeList);
540
+ }
541
+ html += '</li>';
542
+ }
543
+ html += '</ul>';
544
+
545
+ //console.log(html);
546
+
547
+ return html;
548
+
549
+ }
550
+
551
+
552
+ elementTreeList = [];
553
+
554
+ html = elementTree(templateData[0].children, elementTreeList);
555
+ //console.log(elementTreeList);
556
+ elementTreeWrap.innerHTML = html;
557
+
558
+
559
+ function elementTreeHTMl() {
560
+ elementTree = editorSettings.elementTree;
561
  html = '';
562
 
 
563
 
564
+ for(index in elementTree){
565
+ elName = elementTree[index];
 
566
 
567
+ html += '<li>';
568
+ html += '<span>'+elName+'</span>';
569
+ html += '</li>';
570
+ }
571
 
572
+
573
+
574
+ elementTreeWrap.getElementsByTagName('ul')[0].innerHTML = html;
575
+
576
+ }
577
+ //elementTreeHTMl();
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+ function elTreeView(data) {
586
+
587
+
588
+ selectedPath = (editorSettings.selectedElement.path.length != 0) ? editorSettings.selectedElement.path : [0];
589
+
590
+ childrenMain = data[0].children;
591
+
592
+
593
+
594
+ html = '';
595
+
596
+ for (var index in childrenMain){
597
+ element = childrenMain[index];
598
+ elType = (element.elType) ? element.elType : '';
599
  element.index = index;
600
  element.id = elType+"-"+index;
601
+
602
+ children = element.children;
603
+
604
 
605
 
606
 
607
  args = {};
608
 
609
+
610
+ // console.log('#############: ');
611
+ // console.log( [index]);
612
+ // console.log('elType: '+ elType);
613
+ // console.log( element );
614
+
615
+
616
+
617
+
618
+
619
 
620
  html += elementStartTag(element);
621
 
622
  if(children.length > 0){
623
 
624
  selectedPath.splice(0,1);
 
625
  args.selectedPath = selectedPath;
626
 
627
+
628
  generateChildHtml(children, args);
629
  }
630
  html += elementEndTag(element);
634
 
635
 
636
 
637
+
638
+
639
  return html;
640
 
641
 
649
 
650
  for (var index in data){
651
  element = data[index];
 
652
  elType = element.elType;
653
  id = element.id;
654
+
655
  selectedPath = args.selectedPath;
656
+ children = element.children;
657
 
658
+ element.id = (id) ? id : '';
659
+ element.index = index;
660
 
661
+
662
+ //childPath.push(index);
663
+ // console.log('----#############: ');
664
+ // console.log( [index]);
665
+ // console.log('elType: '+ elType);
666
+ // console.log( element );
667
 
668
 
 
669
 
 
 
670
 
671
 
672
  html += elementStartTag(element);
673
 
674
  if( children.length > 0){
675
+
676
  generateChildHtml(children, args);
677
  }
678
 
778
  elId = element.id;
779
  elClass = element.class;
780
  elType = element.elType;
781
+
 
782
 
783
  index = element.index;
784
  children = (children.length != 0) ? element.children : [elementsData.emptyRow];
785
 
786
 
787
+ elData = {elType:elType,index:index,elId:elId,elClass: elClass };
788
+
789
+
790
 
 
791
 
792
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
793
  html += '<div class="containerSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement"><i class="fas fa-check"></i></span><span onclick="removeElement(this, event )" class="remove"><i class="fas fa-times"></i></span></div>';
794
 
795
  // html += '{{el_container}}';
811
  elType = element.elType;
812
  index = element.index;
813
 
814
+
815
+
816
  children = (children.length != 0) ? element.children : [elementsData.emptyColumn];
817
 
818
  html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
835
  elId = element.id;
836
  elClass = element.class;
837
  elType = element.elType;
838
+
839
+
840
+
841
  children = (children.length != 0) ? element.children : [elementsData.empty];
842
 
843
 
845
 
846
  index = element.index;
847
 
848
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
849
  html += '<div class="columnSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement" ><i class="fas fa-check"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
850
 
851
  if(children.length == 0){
852
  html += '<i class="far fa-plus-square"></i>';
853
  }
854
 
 
855
  // html += '{{el_column}}';
856
  // html += '</div>';
857
 
 
 
 
 
 
858
  return html;
859
 
860
  }
869
  innerHtml = element.innerHtml;
870
  index = element.index;
871
 
872
+
873
+
874
  children = element.children;
875
 
876
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
877
+ html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement" ><i class="fas fa-check"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
878
 
879
  html += innerHtml;
880
  // html += '</div>';
895
 
896
  children = element.children;
897
 
898
+
899
+
900
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
901
  html += innerHtml;
902
  // html += '</div>';
903
 
917
 
918
  children = element.children;
919
 
920
+
921
+
922
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
923
  html += innerHtml;
924
  // html += '</div>';
925
 
939
 
940
  children = element.children;
941
 
942
+
943
+
944
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
945
  html += innerHtml;
946
  // html += '</div>';
947
 
972
 
973
  children = element.children;
974
 
975
+
976
+
977
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
978
+ html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement" ><i class="fas fa-check"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
979
 
980
  html += '<a target="'+target+'" href="'+href+'">';
981
  html += innerHtml;
1000
 
1001
  children = element.children;
1002
 
1003
+
1004
+
1005
+
1006
+
1007
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
1008
+ html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement" ><i class="fas fa-check"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
1009
  html += '<'+tag+'>';
1010
  html += innerHtml;
1011
  html += '</'+tag+'>';
1026
  index = element.index;
1027
  src = element.src;
1028
 
1029
+
1030
+
1031
+
1032
+ html += '<div index="'+index+'" id="'+elId+'" class="'+elClass+'" elType="'+elType+'">';
1033
+ html += '<div class="elementSettings"><span onclick="customizeElement(this, event)" class="customizeElement"><i class="far fa-edit"></i></span><span onclick="selectElement(this, event)" class="selectElement" ><i class="fas fa-check"></i></span><span onclick="removeElement(this, event)" class="remove"><i class="fas fa-times"></i></span></div>';
1034
  html += '<img src="'+src+'" />';
1035
  //html += '{{el_text}}';
1036
  // html += '</div>';
1042
  }
1043
 
1044
 
 
1045
 
1046
 
1047
 
1048
 
1049
  function removeElement(currentEl, event){
1050
 
 
1051
 
1052
 
1053
  newtemplateData = templateData;
 
1054
 
1055
 
1056
  event.stopPropagation();
1062
  elClass = el.getAttribute('class');
1063
 
1064
 
 
 
 
1065
 
1066
  var els = [];
1067
  var Indexes = [elIndex];
1075
  elIndex = el.getAttribute('index');
1076
  elClass = el.getAttribute('class');
1077
 
1078
+
 
 
1079
 
1080
  if(elIndex !== null)
1081
  Indexes.push(elIndex);
1097
 
1098
  indexCount = Indexes.length;
1099
 
 
1100
 
1101
  if(indexCount == 1){
1102
  //delete templateData[Indexes[0]];
1103
  newtemplateData.splice(Indexes[0], 1);
 
1104
  templatePreview.innerHTML = elTreeView(newtemplateData);
1105
 
1106
  }else{
1107
 
 
1108
 
1109
  containerIndex = Indexes[0];
1110
+
 
1111
  Indexes.splice(0, 1);
1112
 
1113
+
 
1114
 
1115
 
1116
  newData = deletetemplateData(Indexes, newtemplateData[containerIndex]);
1117
  templatePreview.innerHTML = elTreeView(newtemplateData);
1118
 
 
1119
  //
1120
  // if(typeof newData !== 'undefined' && newData !== null){
 
1121
  //
1122
  // templateData[containerIndex] = newData;
1123
  // }
1124
 
1125
  }
1126
 
 
1127
 
1128
 
1129
  }
1133
 
1134
  function deletetemplateData(index, data) {
1135
 
 
 
 
 
 
 
1136
  indexCount = index.length;
1137
 
 
 
 
 
1138
 
1139
  if(indexCount > 1){
1140
 
1141
  newData = data.children[index[0]];
 
1142
 
1143
  //delete index[0];
1144
  index.splice(0,1);
1145
 
1146
 
 
1147
 
1148
  data = deletetemplateData(index, newData);
1149
 
1152
 
1153
  }else{
1154
 
 
1155
 
1156
  data.children.splice(index[0], 1);
1157
 
 
1158
 
1159
 
1160
  return data;
1162
 
1163
 
1164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1165
 
1166
  }
1167
 
1180
 
1181
  toolsToggle = document.querySelectorAll('.tools-toggle');
1182
 
 
1183
 
1184
 
1185
  }
1187
 
1188
  function customizeElement(currentEl, event) {
1189
 
 
1190
  editorSettings.activeTab = 1;
1191
  tools_tabs_switch(editorSettings);
1192
 
1194
  el = currentEl;
1195
  selectElement(currentEl, event);
1196
 
1197
+ elType = editorSettings.selectedElement.elType;
1198
  path = editorSettings.selectedElement.path;
1199
 
1200
 
 
1201
  generateElementSettings(elType);
1202
 
1203
 
1204
  }
1205
 
 
1206
 
 
1207
 
1208
 
1209
+ function getElementByIndex(templateData, index){
1210
+ //console.log(templateData);
1211
+
1212
+ //console.log('indexes: ');
1213
+ //console.log(index);
1214
+
1215
+ indexlength = index.length;
1216
+ //console.log('indexlength: '+ indexlength);
1217
+
1218
+ if(indexlength == 1){
1219
+
1220
+ //console.log('Retunred element');
1221
+ //console.log(templateData[index[0]]);
1222
+ //editorSettings.editElementData.data = templateData[index[0]];
1223
+
1224
+ //console.log(editorSettings);
1225
+
1226
+ return templateData[index[0]];
1227
+
1228
+
1229
+ }
1230
+
1231
+
1232
+
1233
+
1234
+ if(indexlength > 1){
1235
+ for (var x in index) {
1236
+ templateDataChild = templateData[index[x]].children;
1237
+
1238
+ index.shift();
1239
+ getElementByIndex( templateDataChild, index);
1240
+ }
1241
+ }
1242
+
1243
+ }
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+
1253
+
1254
+ function selectElement(currentEl, event){
1255
  event.stopPropagation();
1256
 
1257
  el = currentEl;
1261
  elClass = el.getAttribute('class');
1262
 
1263
 
 
 
 
1264
 
1265
  var els = [];
1266
  var Indexes = [elIndex];
1273
  elId = el.getAttribute('id');
1274
  elIndex = el.getAttribute('index');
1275
  elClass = el.getAttribute('class');
 
1276
 
1277
+ elData = el.getAttribute('elData');
1278
+
1279
+ console.log(elData);
1280
 
 
 
 
1281
 
1282
  if(elIndex !== null)
1283
  Indexes.push(elIndex);
1296
  return item != null;
1297
  });
1298
 
 
1299
 
1300
  currentEl.parentNode.parentNode.setAttribute("path", Indexes);
1301
  elType = currentEl.parentNode.parentNode.getAttribute('elType');
1302
 
1303
 
 
 
 
1304
  editorSettings.selectedElement.path = Indexes;
1305
  editorSettings.selectedElement.elType = elType;
1306
 
1307
 
 
 
1308
 
1309
+ //console.log('Main data: ');
1310
+ //console.log(templateData[0].children);
 
1311
 
1312
+ selectedElementData = getElementByIndex( templateData[0].children, Indexes);
1313
 
 
1314
 
1315
+ console.log(selectedElementData);
1316
 
 
1317
 
1318
+ }
1319
+
1320
 
1321
+ function addElement(event, element ){
1322
 
1323
+ event.stopPropagation();
1324
 
1325
+ var elType = element.elType;
1326
 
1327
 
1328
  selectedElement = editorSettings.selectedElement;
 
1329
 
1330
 
1331
  selectedelType = (selectedElement.elType) ? selectedElement.elType : 'container';
1332
  selectedPath = (selectedElement.path.length != 0) ? selectedElement.path : ["0"];
1333
 
 
 
 
 
 
 
 
 
 
 
 
1334
  if(selectedelType == 'container'){
1335
 
1336
  if(elType == 'container'){
1341
  containerIndex = selectedPath[0];
1342
  rowIndex = selectedPath[1];
1343
 
 
1344
 
1345
  templateData[containerIndex].children.push(elementsData[elType]);
1346
 
1390
  containerIndex = selectedPath[0];
1391
  rowIndex = selectedPath[1];
1392
 
 
 
1393
  templateData[containerIndex].children.push(elementsData[elType]);
1394
 
1395
 
1419
 
1420
  }
1421
 
 
1422
  templatePreview.innerHTML = elTreeView(templateData);
1423
 
1424
 
includes/classes/class-shortcodes.php CHANGED
@@ -7,7 +7,6 @@ class class_post_grid_shortcodes{
7
  public function __construct(){
8
 
9
  add_shortcode( 'post_grid', array( $this, 'post_grid_new_display' ) );
10
- add_shortcode( 'post_grid_layout_builder', array( $this, 'post_grid_layout_builder' ) );
11
 
12
  }
13
 
@@ -50,46 +49,6 @@ class class_post_grid_shortcodes{
50
  }
51
 
52
 
53
- public function post_grid_layout_builder($atts, $content = null ){
54
-
55
- $atts = shortcode_atts(
56
- array(
57
- 'id' => "",
58
- ),
59
- $atts
60
- );
61
-
62
- $atts = apply_filters('post_grid_atts',$atts);
63
-
64
- $grid_id = $atts['id'];
65
-
66
-
67
-
68
-
69
- //wp_reset_postdata();
70
-
71
- ob_start();
72
-
73
- do_action('post_grid_layout_builder', $atts);
74
-
75
-
76
-
77
-
78
- return ob_get_clean();
79
-
80
-
81
- }
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
 
94
 
95
 
7
  public function __construct(){
8
 
9
  add_shortcode( 'post_grid', array( $this, 'post_grid_new_display' ) );
 
10
 
11
  }
12
 
49
  }
50
 
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
 
54
 
includes/functions-data-upgrade.php CHANGED
@@ -1239,10 +1239,8 @@ function post_grid_import_xml_layouts(){
1239
 
1240
  $response = array();
1241
  $user_id = get_current_user_id();
1242
- $source = sanitize_text_field($_POST['source']);
1243
- $skip = sanitize_text_field($_POST['skip']);
1244
-
1245
- //$xml_source = 'http://localhost/wp/wp-content/plugins/post-grid/sample-data/post-grid-layouts.json';
1246
 
1247
 
1248
  if($skip == 'yes'){
@@ -1260,15 +1258,21 @@ function post_grid_import_xml_layouts(){
1260
  die();
1261
  }
1262
 
 
 
 
 
 
 
1263
 
1264
- $json_obj = file_get_contents($source);
1265
 
1266
  //$xml_json = json_encode($html_obj);
1267
  $xml_arr = json_decode($json_obj, true);
1268
 
1269
 
1270
- $items = $xml_arr['rss']['channel']['item'];
1271
 
 
1272
  foreach ($items as $item){
1273
 
1274
  $post_title = isset($item['title']) ? $item['title'] : '';
1239
 
1240
  $response = array();
1241
  $user_id = get_current_user_id();
1242
+ $source = isset($_POST['source']) ? sanitize_text_field($_POST['source']) : '';
1243
+ $skip = isset($_POST['skip']) ? sanitize_text_field($_POST['skip']) : '';
 
 
1244
 
1245
 
1246
  if($skip == 'yes'){
1258
  die();
1259
  }
1260
 
1261
+ if(!empty($source)){
1262
+ $json_obj = file_get_contents($source);
1263
+ }else{
1264
+ $json_obj = '';
1265
+ }
1266
+
1267
 
 
1268
 
1269
  //$xml_json = json_encode($html_obj);
1270
  $xml_arr = json_decode($json_obj, true);
1271
 
1272
 
1273
+ $items = isset($xml_arr['rss']['channel']['item']) ? $xml_arr['rss']['channel']['item'] : array();
1274
 
1275
+ if(!empty($items))
1276
  foreach ($items as $item){
1277
 
1278
  $post_title = isset($item['title']) ? $item['title'] : '';
includes/metabox-post-grid-hook.php CHANGED
@@ -287,6 +287,8 @@ function post_grid_metabox_tabs_content_query_post($tab, $post_id){
287
 
288
  $posts_per_page = !empty($post_grid_meta_options['posts_per_page']) ? $post_grid_meta_options['posts_per_page'] : 10;
289
  $offset = isset($post_grid_meta_options['offset']) ? $post_grid_meta_options['offset'] : '0';
 
 
290
  $exclude_post_id = isset($post_grid_meta_options['exclude_post_id']) ? $post_grid_meta_options['exclude_post_id'] : '';
291
  $include_post_id = isset($post_grid_meta_options['include_post_id']) ? $post_grid_meta_options['include_post_id'] : '';
292
 
@@ -523,6 +525,24 @@ function post_grid_metabox_tabs_content_query_post($tab, $post_id){
523
 
524
  $settings_tabs_field->generate_field($args, $post_id);
525
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
 
527
  $args = array(
528
  'id' => 'exclude_post_id',
287
 
288
  $posts_per_page = !empty($post_grid_meta_options['posts_per_page']) ? $post_grid_meta_options['posts_per_page'] : 10;
289
  $offset = isset($post_grid_meta_options['offset']) ? $post_grid_meta_options['offset'] : '0';
290
+ $ignore_paged = isset($post_grid_meta_options['ignore_paged']) ? $post_grid_meta_options['ignore_paged'] : 'no';
291
+
292
  $exclude_post_id = isset($post_grid_meta_options['exclude_post_id']) ? $post_grid_meta_options['exclude_post_id'] : '';
293
  $include_post_id = isset($post_grid_meta_options['include_post_id']) ? $post_grid_meta_options['include_post_id'] : '';
294
 
525
 
526
  $settings_tabs_field->generate_field($args, $post_id);
527
 
528
+ $args = array(
529
+ 'id' => 'ignore_paged',
530
+ 'parent' => 'post_grid_meta_options',
531
+ 'title' => __('Ignore paged/page query','woocommerce-products-slider'),
532
+ 'details' => __('Ignore paged/page variable from query.','woocommerce-products-slider'),
533
+ 'type' => 'select',
534
+ //'for' => $taxonomy,
535
+ //'multiple' => true,
536
+ 'value' => $ignore_paged,
537
+ 'default' => 'no',
538
+ 'args' => array(
539
+ 'no'=>__('No','woocommerce-products-slider'),
540
+ 'yes'=>__('Yes','woocommerce-products-slider'),
541
+ ),
542
+ );
543
+
544
+ $settings_tabs_field->generate_field($args, $post_id);
545
+
546
 
547
  $args = array(
548
  'id' => 'exclude_post_id',
includes/settings-hook.php CHANGED
@@ -86,6 +86,9 @@ if(!function_exists('post_grid_settings_content_help_support')) {
86
 
87
  $settings_tabs_field = new settings_tabs_field();
88
 
 
 
 
89
  if (is_plugin_active('post-grid-pro/post-grid-pro.php')){
90
  $layouts_pro_url = post_grid_pro_plugin_url.'sample-data/post-grid-layouts.xml';
91
  $layouts_pro_url_json = post_grid_pro_plugin_url.'sample-data/post-grid-layouts.json';
86
 
87
  $settings_tabs_field = new settings_tabs_field();
88
 
89
+ $layouts_pro_url = '';
90
+ $layouts_pro_url_json = '';
91
+
92
  if (is_plugin_active('post-grid-pro/post-grid-pro.php')){
93
  $layouts_pro_url = post_grid_pro_plugin_url.'sample-data/post-grid-layouts.xml';
94
  $layouts_pro_url_json = post_grid_pro_plugin_url.'sample-data/post-grid-layouts.json';
post-grid.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Post Grid by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/
5
  Description: Awesome post grid for query post from any post type and display on grid.
6
- Version: 2.0.64
7
  Author: PickPlugins
8
  Author URI: https://www.pickplugins.com/
9
  License: GPLv2 or later
@@ -21,7 +21,7 @@ if( !class_exists( 'PostGrid' )){
21
  define('post_grid_plugin_dir', plugin_dir_path(__FILE__));
22
  define('post_grid_plugin_basename', plugin_basename(__FILE__));
23
  define('post_grid_plugin_name', 'Post Grid');
24
- define('post_grid_version', '2.0.64');
25
 
26
 
27
 
@@ -42,7 +42,6 @@ if( !class_exists( 'PostGrid' )){
42
 
43
  include('includes/settings-hook.php');
44
  include('templates/post-grid-hook.php');
45
- include('templates/layout-builder-hook.php');
46
 
47
  include('includes/post-grid-layout-elements.php');
48
  include('includes/media-source-options.php');
@@ -165,12 +164,6 @@ if( !class_exists( 'PostGrid' )){
165
  wp_register_style('font-awesome-4', post_grid_plugin_url.'assets/global/css/font-awesome-4.css');
166
  wp_register_style('font-awesome-5', post_grid_plugin_url.'assets/global/css/font-awesome-5.css');
167
 
168
- wp_register_script('layout-builder', post_grid_plugin_url.'assets/frontend/js/layout-builder.js', array('jquery'), time());
169
-
170
- //wp_register_style('bootstrap', post_grid_plugin_url.'assets/global/css/bootstrap.min.css');
171
- //wp_register_style('bootstrap-grid', post_grid_plugin_url.'assets/global/css/bootstrap-grid.css');
172
-
173
-
174
  }
175
 
176
 
3
  Plugin Name: Post Grid by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/
5
  Description: Awesome post grid for query post from any post type and display on grid.
6
+ Version: 2.0.65
7
  Author: PickPlugins
8
  Author URI: https://www.pickplugins.com/
9
  License: GPLv2 or later
21
  define('post_grid_plugin_dir', plugin_dir_path(__FILE__));
22
  define('post_grid_plugin_basename', plugin_basename(__FILE__));
23
  define('post_grid_plugin_name', 'Post Grid');
24
+ define('post_grid_version', '2.0.65');
25
 
26
 
27
 
42
 
43
  include('includes/settings-hook.php');
44
  include('templates/post-grid-hook.php');
 
45
 
46
  include('includes/post-grid-layout-elements.php');
47
  include('includes/media-source-options.php');
164
  wp_register_style('font-awesome-4', post_grid_plugin_url.'assets/global/css/font-awesome-4.css');
165
  wp_register_style('font-awesome-5', post_grid_plugin_url.'assets/global/css/font-awesome-5.css');
166
 
 
 
 
 
 
 
167
  }
168
 
169
 
readme.txt CHANGED
@@ -4,7 +4,7 @@
4
  Tags: post grid, grid, custom post grid, post type grid, grid display, category filter, custom post, filter, filtering, grid, layout, list, masonry, post, post filter, post layout, taxonomy, taxonomy filter,
5
  Requires at least: 3.8
6
  Tested up to: 5.4
7
- Stable tag: 2.0.64
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -216,6 +216,9 @@ then paste this shortcode anywhere in your page to display grid<br />
216
 
217
  == Changelog ==
218
 
 
 
 
219
  = 2.0.64 =
220
  * 2020-06-04 fix - layout import skip added.
221
 
4
  Tags: post grid, grid, custom post grid, post type grid, grid display, category filter, custom post, filter, filtering, grid, layout, list, masonry, post, post filter, post layout, taxonomy, taxonomy filter,
5
  Requires at least: 3.8
6
  Tested up to: 5.4
7
+ Stable tag: 2.0.65
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
216
 
217
  == Changelog ==
218
 
219
+ = 2.0.65 =
220
+ * 2020-06-04 add - Ignore paged/page variable from query to display same posts on paginated page.
221
+
222
  = 2.0.64 =
223
  * 2020-06-04 fix - layout import skip added.
224
 
templates/layout-builder-hook.php DELETED
@@ -1,480 +0,0 @@
1
- <?php
2
- if ( ! defined('ABSPATH')) exit; // if direct access
3
-
4
-
5
- add_action('post_grid_layout_builder', 'post_grid_layout_builder');
6
-
7
-
8
- function post_grid_layout_builder(){
9
- wp_enqueue_script('layout-builder');
10
- wp_enqueue_style('bootstrap');
11
- //wp_enqueue_style('bootstrap-grid');
12
-
13
-
14
- wp_enqueue_style('font-awesome-5');
15
-
16
- ?>
17
-
18
- <div class="pglb">
19
- <div class="" id="template-tools">
20
- <div class="tools-tabs">
21
- <ul class="tab-navs">
22
- <li class="nav" data-id="1">Elements</li>
23
- <li class="nav" data-id="2">Settings</li>
24
- <li class="nav" data-id="3">Library</li>
25
- </ul>
26
-
27
- <div class="tab-content data-id-1" >
28
-
29
- <div class="tools-toggle">
30
- <div class="toggle-header">Layout</div>
31
- <div class="toggle-content">
32
- <div class="element-list">
33
- <div class="layoutElement" onclick="addElement(event, {elType:'container'})" >Container</div>
34
- <div class="layoutElement" onclick="addElement(event, {elType:'row'})" >Row</div>
35
- <div class="layoutElement" onclick="addElement(event, {elType:'column'})" >Column</div>
36
- </div>
37
-
38
- </div>
39
- </div>
40
-
41
-
42
- <div class="tools-toggle">
43
- <div class="toggle-header">General</div>
44
- <div class="toggle-content">
45
- <div class="element-list">
46
- <div class="layoutElement" onclick="addElement(event, {elType:'heading'})">Heading</div>
47
- <div class="layoutElement" onclick="addElement(event, {elType:'text'})">Text</div>
48
- <div class="layoutElement" onclick="addElement(event, {elType:'image'})">Image</div>
49
- <div class="layoutElement" onclick="addElement(event, {elType:'link'})">Link</div>
50
- </div>
51
-
52
- </div>
53
- </div>
54
-
55
- <div class="tools-toggle">
56
- <div class="toggle-header">Post Elements</div>
57
- <div class="toggle-content">
58
- <div class="element-list">
59
- <div class="layoutElement" onclick="addElement(event, {elType:'post_title'})" >Post Title</div>
60
- <div class="layoutElement" onclick="addElement(event, {elType:'post_featured_image'})" >Post Thumbnail</div>
61
- <div class="layoutElement" onclick="addElement(event, {elType:'post_excerpt'})" >Post Excerpt</div>
62
- <div class="layoutElement" onclick="addElement(event, {elType:'post_date'})" >Post Date</div>
63
- <div class="layoutElement" onclick="addElement(event, {elType:'post_author'})">Post Author</div>
64
- <div class="layoutElement" onclick="addElement(event, {elType:'post_categories'})">Post Categories</div>
65
- <div class="layoutElement" onclick="addElement(event, {elType:'post_tags'})">Post Tags</div>
66
- <div class="layoutElement" onclick="addElement(event, {elType:'post_terms'})">Post Terms</div>
67
- <div class="layoutElement" onclick="addElement(event, {elType:'post_comments_count'})">Comments Count</div>
68
- <div class="layoutElement" onclick="addElement(event, {elType:'post_comments'})">Post Comments</div>
69
- <div class="layoutElement" onclick="addElement(event, {elType:'post_edit_link'})" >Post Edit Link</div>
70
- <div class="layoutElement" onclick="addElement(event, {elType:'next_post_link'})">Next Post Link</div>
71
- <div class="layoutElement" onclick="addElement(event, {elType:'previous_post_link'})">Previous Post Link</div>
72
- <div class="layoutElement" onclick="addElement(event, {elType:'related_posts'})">Related posts</div>
73
-
74
- <div class="layoutElement" onclick="addElement(event, {elType:'post_id'})" >Post ID</div>
75
- <div class="layoutElement" onclick="addElement(event, {elType:'post_is_sticky'})" >Post Sticky</div>
76
- <div class="layoutElement" onclick="addElement(event, {elType:'post_status'})" >Post Status</div>
77
- <div class="layoutElement" onclick="addElement(event, {elType:'post_format'})" >Post Format</div>
78
- <div class="layoutElement" onclick="addElement(event, {elType:'post_type'})" >Post Type</div>
79
-
80
- </div>
81
-
82
- </div>
83
-
84
- </div>
85
-
86
- <div class="tools-toggle">
87
- <div class="toggle-header">Archive Elements</div>
88
- <div class="toggle-content">
89
- <div class="element-list">
90
- <div class="layoutElement" onclick="addElement(event, {elType:'author_name'})" >Author Name</div>
91
- <div class="layoutElement" onclick="addElement(event, {elType:'author_avatar'})" >Author Avatar</div>
92
- <div class="layoutElement" onclick="addElement(event, {elType:'term_title'})" >Term Title</div>
93
- <div class="layoutElement" onclick="addElement(event, {elType:'term_id'})" >Term ID</div>
94
-
95
- <div class="layoutElement" onclick="addElement(event, {elType:'term_edit_link'})" >Term Edit Link</div>
96
-
97
- <div class="layoutElement" onclick="addElement(event, {elType:'term_description'})" >Term Description</div>
98
- <div class="layoutElement" onclick="addElement(event, {elType:'date_title'})">Date Title</div>
99
- <div class="layoutElement" onclick="addElement(event, {elType:'month_title'})">Month Title</div>
100
- <div class="layoutElement" onclick="addElement(event, {elType:'year_title'})">Year Title</div>
101
- <div class="layoutElement" onclick="addElement(event, {elType:'search_query'})">Search Query</div>
102
-
103
- <div class="layoutElement" onclick="addElement(event, {elType:'next_posts_link'})">Next Posts Link</div>
104
- <div class="layoutElement" onclick="addElement(event, {elType:'previous_posts_link'})">Previous Posts Link</div>
105
-
106
- </div>
107
-
108
- </div>
109
-
110
- </div>
111
-
112
- <div class="tools-toggle">
113
- <div class="toggle-header">Global Elements</div>
114
- <div class="toggle-content">
115
- <div class="element-list">
116
- <div class="layoutElement" onclick="addElement(event, {elType:'site_header'})" >Site header</div>
117
- <div class="layoutElement" onclick="addElement(event, {elType:'site_footer'})" >Site footer</div>
118
-
119
- <div class="layoutElement" onclick="addElement(event, {elType:'site_title'})" >Site Tile</div>
120
- <div class="layoutElement" onclick="addElement(event, {elType:'search_form'})" >Search form</div>
121
-
122
- <div class="layoutElement" onclick="addElement(event, {elType:'breadcrumb'})" >Breadcrumb</div>
123
- <div class="layoutElement" onclick="addElement(event, {elType:'nav_menu'})" >Nav Menu</div>
124
- <div class="layoutElement" onclick="addElement(event, {elType:'term_edit_link'})" >Term Edit Link</div>
125
-
126
- <div class="layoutElement" onclick="addElement(event, {elType:'term_description'})" >Term Description</div>
127
- <div class="layoutElement" onclick="addElement(event, {elType:'date_title'})">Date Title</div>
128
- <div class="layoutElement" onclick="addElement(event, {elType:'month_title'})">Month Title</div>
129
- <div class="layoutElement" onclick="addElement(event, {elType:'year_title'})">Year Title</div>
130
- <div class="layoutElement" onclick="addElement(event, {elType:'search_query'})">Search Query</div>
131
-
132
- <div class="layoutElement" onclick="addElement(event, {elType:'next_posts_link'})">Next Posts Link</div>
133
- <div class="layoutElement" onclick="addElement(event, {elType:'previous_posts_link'})">Previous Posts Link</div>
134
-
135
- </div>
136
-
137
- </div>
138
-
139
- </div>
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
- </div>
148
- <div class="tab-content data-id-2" >
149
-
150
- <div id="selectedObjectSettings">
151
- </div>
152
-
153
- </div>
154
-
155
- <div class="tab-content data-id-3" >
156
-
157
- <div class="tools-toggle">
158
- <div class="toggle-header">General</div>
159
- <div class="toggle-content">
160
-
161
- General content
162
-
163
- </div>
164
-
165
- </div>
166
-
167
- </div>
168
-
169
- </div>
170
- </div>
171
- <div class="" id="template-preview"></div>
172
-
173
- </div>
174
-
175
-
176
-
177
-
178
-
179
-
180
- <?php
181
-
182
-
183
- }
184
-
185
-
186
-
187
-
188
- add_action('post_grid_layout_builder', 'post_grid_layout_builder_css');
189
-
190
-
191
- function post_grid_layout_builder_css(){
192
-
193
- ?>
194
- <style type="text/css">
195
- #template-tools{}
196
- #template-preview{}
197
-
198
-
199
-
200
-
201
-
202
- /*pglb-container*/
203
-
204
- /*.pglb .pglb-container.active, .pglb .pglb-row.active,.pglb .pglb-column.active, .pglb .pglb-element.active {*/
205
- /* border: 1px dashed #007bff;*/
206
- /*}*/
207
-
208
- /*.pglb .pglb-container[isactive="active"], .pglb .pglb-row[isactive="active"],.pglb .pglb-column[isactive="active"], .pglb .pglb-element[isactive="active"] {*/
209
- /* border: 1px dashed #007bff;*/
210
- /*}*/
211
-
212
- .pglb .pglb-container, .pglb .pglb-row,.pglb .pglb-column, .pglb .pglb-element{
213
- border: 1px dashed rgba(0,0,0,0);
214
- }
215
- .pglb .pglb-container{
216
- position: relative;
217
- }
218
-
219
- .pglb .pglb-container:hover{
220
- border: 1px dashed #007bff;
221
- }
222
- .pglb .pglb-container:hover .containerSettings{
223
- display: inline-block;
224
- }
225
- .pglb .containerSettings{
226
- position: absolute;
227
- top: -25px;
228
- left: 0;
229
- background: #3a5673;
230
- color: #fff;
231
- display: none;
232
- z-index: 99999;
233
- }
234
-
235
-
236
- .pglb .containerSettings span{
237
- padding: 2px 7px;
238
- border-left: 1px solid #7892ab;
239
- cursor: pointer;
240
- }
241
-
242
- /*pglb-row*/
243
- .pglb .pglb-row{
244
- position: relative;
245
- }
246
- .pglb .pglb-row:hover{
247
- border: 1px dashed #007bff;
248
- }
249
-
250
- .pglb .pglb-row:hover .rowSettings{
251
- display: inline-block;
252
- }
253
- .pglb .rowSettings{
254
- position: absolute;
255
- top: 0;
256
- left: 0;
257
- background: #3a5673;
258
- color: #fff;
259
- display: none;
260
- z-index: 99999;
261
- }
262
-
263
-
264
- .pglb .rowSettings span{
265
- padding: 2px 7px;
266
- border-left: 1px solid #7892ab;
267
- cursor: pointer;
268
- }
269
-
270
-
271
-
272
-
273
-
274
- /*pglb-column*/
275
- .pglb .pglb-column{
276
- background: #f9f9f9;
277
- }
278
-
279
-
280
- .pglb .pglb-column:hover{
281
- border: 1px dashed #007bff;
282
- }
283
- .pglb .pglb-column:hover .columnSettings{
284
- display: inline-block;
285
- }
286
- .pglb .columnSettings{
287
- position: absolute;
288
- top: 0;
289
- right: 0;
290
- background: #3a5673;
291
- color: #fff;
292
- display: none;
293
- z-index: 99999;
294
- }
295
-
296
-
297
- .pglb .columnSettings span{
298
- padding: 2px 7px;
299
- border-left: 1px solid #7892ab;
300
- cursor: pointer;
301
- }
302
-
303
- .pglb .remove:hover{
304
- background: #ff4b03;
305
- }
306
-
307
-
308
-
309
-
310
-
311
- /*pglb-elementSettings*/
312
- .pglb .pglb-element{
313
- background: #f9f9f9;
314
- position: relative;
315
- }
316
-
317
-
318
- .pglb .pglb-element:hover{
319
- border: 1px dashed #007bff;
320
- }
321
- .pglb .pglb-element:hover .elementSettings{
322
- display: inline-block;
323
- }
324
- .pglb .elementSettings{
325
- position: absolute;
326
- bottom: 0;
327
- right: 50%;
328
- background: #3a5673;
329
- color: #fff;
330
- display: none;
331
- z-index: 99999;
332
- transform: translate(50%, 0);
333
- }
334
-
335
-
336
- .pglb .elementSettings span{
337
- padding: 2px 7px;
338
- border-left: 1px solid #7892ab;
339
- cursor: pointer;
340
- }
341
-
342
- .pglb .remove:hover{
343
- background: #ff4b03;
344
- }
345
-
346
- .pglb .selectElement:hover{
347
- background: #22af61;
348
- }
349
- .pglb .customizeElement:hover{
350
- background: #308ad2;
351
- }
352
-
353
-
354
-
355
-
356
- /*Tools*/
357
-
358
-
359
- #template-tools {
360
- position: fixed;
361
- top: 0px;
362
- width: 380px;
363
- background: #f3f9ff;
364
- z-index: 999999999999999999999;
365
- height: 100%;
366
- left: 0;
367
- box-shadow: 0 0 6px -3px rgba(0, 0, 0, 0.43);
368
- overflow-y: scroll;
369
-
370
- }
371
-
372
- .admin-bar #template-tools{
373
- top: 32px;
374
- }
375
-
376
-
377
- body{
378
- margin-left: 380px !important;
379
- }
380
-
381
-
382
-
383
- #template-tools .tab-navs{
384
- margin: 0;
385
- padding: 0;
386
- }
387
- #template-tools .tab-navs .nav{
388
- display: inline-block;
389
- width: 33%;
390
- padding: 15px 0px;
391
- background: #3a5673;
392
- margin: 0;
393
- float: left;
394
- color: #fff;
395
- border-right: 1px solid #46617b;
396
- text-align: center;
397
- cursor: pointer;
398
- font-size: 14px;
399
-
400
- }
401
-
402
- #template-tools .tab-navs .nav.active{
403
- background: #314861;
404
- }
405
- #template-tools .tab-content{
406
- clear: both;
407
- padding: 10px;
408
- }
409
-
410
- #template-tools .tab-content.inactive{
411
- display: none;
412
- }
413
-
414
- #template-tools .element-list{
415
- margin: 0;
416
- padding: 15px 13px;
417
- display: block;
418
- }
419
-
420
- #template-tools .element-list .layoutElement{
421
- display: inline-block;
422
- width: 49.1%;
423
- text-align: center;
424
- padding: 10px 0px;
425
- background: #48617982;
426
- margin: 2px 0;
427
- cursor: pointer;
428
- color: #fff;
429
- font-size: 14px;
430
- border-radius: 3px;
431
- }
432
-
433
-
434
- #template-tools .tools-toggle{
435
- clear: both;
436
- }
437
- #template-tools .toggle-header{
438
- padding: 10px 10px;
439
- background: #6c7d8e;
440
- color: #fff;
441
- margin: 0px 0 7px 0;
442
- cursor: pointer;
443
- }
444
- #template-tools .toggle-content{
445
- display: none;
446
- }
447
-
448
- #template-tools .tools-toggle.active .toggle-content{
449
- display: block;
450
- }
451
-
452
-
453
-
454
-
455
-
456
-
457
- </style>
458
- <?php
459
-
460
-
461
- }
462
-
463
-
464
- add_action('post_grid_layout_builder', 'post_grid_layout_builder_script');
465
-
466
-
467
- function post_grid_layout_builder_script(){
468
-
469
- ?>
470
- <script>
471
-
472
-
473
- </script>
474
- <?php
475
-
476
-
477
- }
478
-
479
-
480
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/post-grid-hook.php CHANGED
@@ -159,6 +159,7 @@ function post_grid_posts_loop($args){
159
  $offset = isset($post_grid_options['offset']) ? (int)$post_grid_options['offset'] : '';
160
  $posts_per_page = isset($post_grid_options['posts_per_page']) ? $post_grid_options['posts_per_page'] : 10;
161
  $query_orderby_meta_key = isset($post_grid_options['query_orderby_meta_key']) ? $post_grid_options['query_orderby_meta_key'] : '';
 
162
 
163
 
164
  $taxonomies = !empty($post_grid_options['taxonomies']) ? $post_grid_options['taxonomies'] : array();
@@ -217,6 +218,9 @@ function post_grid_posts_loop($args){
217
  $paged = 1;
218
  }
219
 
 
 
 
220
 
221
 
222
 
159
  $offset = isset($post_grid_options['offset']) ? (int)$post_grid_options['offset'] : '';
160
  $posts_per_page = isset($post_grid_options['posts_per_page']) ? $post_grid_options['posts_per_page'] : 10;
161
  $query_orderby_meta_key = isset($post_grid_options['query_orderby_meta_key']) ? $post_grid_options['query_orderby_meta_key'] : '';
162
+ $ignore_paged = isset($post_grid_options['ignore_paged']) ? $post_grid_options['ignore_paged'] : 'no';
163
 
164
 
165
  $taxonomies = !empty($post_grid_options['taxonomies']) ? $post_grid_options['taxonomies'] : array();
218
  $paged = 1;
219
  }
220
 
221
+ if($ignore_paged == 'yes'){
222
+ $paged = 1;
223
+ }
224
 
225
 
226