Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.89 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Registers the `qubely/postgrid` block on server.
  5. *
  6. * @since 1.1.0
  7. */
  8. function register_block_qubely_postgrid()
  9. {
  10. // Check if the register function exists.
  11. if (!function_exists('register_block_type')) {
  12. return;
  13. }
  14. register_block_type(
  15. 'qubely/postgrid',
  16. array(
  17. 'attributes' => array(
  18. 'uniqueId' => array(
  19. 'type' => 'string',
  20. 'default' => '',
  21. ),
  22. //general
  23. 'postType' => array(
  24. 'type' => 'string',
  25. 'default' => 'Posts',
  26. ),
  27. 'taxonomy' => array(
  28. 'type' => 'string',
  29. 'default' => 'categories',
  30. ),
  31. 'categories' => array(
  32. 'type' => 'array',
  33. 'default' => [],
  34. 'items' => [
  35. 'type' => 'object'
  36. ],
  37. ),
  38. 'tags' => array(
  39. 'type' => 'array',
  40. 'default' => [],
  41. 'items' => [
  42. 'type' => 'object'
  43. ],
  44. ),
  45. 'order' => array(
  46. 'type' => 'string',
  47. 'default' => 'desc',
  48. ),
  49. 'orderBy' => array(
  50. 'type' => 'string',
  51. 'default' => 'date',
  52. ),
  53. //layout
  54. 'layout' => array(
  55. 'type' => 'number',
  56. 'default' => 1
  57. ),
  58. 'style' => array(
  59. 'type' => 'number',
  60. 'default' => 1
  61. ),
  62. 'column' => array(
  63. 'type' => 'object',
  64. 'default' => array('md' => 3, 'sm' => 2, 'xs' => 1),
  65. ),
  66.  
  67. //content
  68. 'showTitle' => array(
  69. 'type' => 'boolean',
  70. 'default' => true
  71. ),
  72. 'titlePosition' => array(
  73. 'type' => 'boolean',
  74. 'default' => true,
  75. ),
  76. 'showCategory' => array(
  77. 'type' => 'string',
  78. 'default' => 'default',
  79. ),
  80. 'categoryPosition' => array(
  81. 'type' => 'string',
  82. 'default' => 'leftTop',
  83. ),
  84. 'badgePosition' => array(
  85. 'type' => 'string',
  86. 'default' => 'default',
  87. ),
  88. 'badgePadding' => array(
  89. 'type' => 'object',
  90. 'default' => (object) [
  91. 'paddingType' => 'custom',
  92. 'unit' => 'px',
  93. ],
  94. 'style' => [
  95. (object) [
  96. 'condition' => [
  97. (object) ['key' => 'layout', 'relation' => '==', 'value' => 2,],
  98. (object) ['key' => 'style', 'relation' => '!=', 'value' => 4],
  99. (object) ['key' => 'badgePosition', 'relation' => '!=', 'value' => 'default'],
  100. ],
  101. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-post-grid-wrapper .qubely-postgrid-cat-position'
  102. ]
  103. ]
  104. ),
  105. 'showDates' => array(
  106. 'type' => 'boolean',
  107. 'default' => true
  108. ),
  109. 'showComment' => array(
  110. 'type' => 'boolean',
  111. 'default' => true
  112. ),
  113. 'showAuthor' => array(
  114. 'type' => 'boolean',
  115. 'default' => true
  116. ),
  117. 'showExcerpt' => array(
  118. 'type' => 'boolean',
  119. 'default' => true
  120. ),
  121. 'excerptLimit' => array(
  122. 'type' => 'number',
  123. 'default' => 20
  124. ),
  125. 'showReadMore' => array(
  126. 'type' => 'boolean',
  127. 'default' => false
  128. ),
  129. 'verticalAlignment' => array(
  130. 'type' => 'string',
  131. 'default' => 'center',
  132. ),
  133. 'items' => array(
  134. 'type' => 'number',
  135. 'default' => 2,
  136. ),
  137. 'excerptCharLength' => array(
  138. 'type' => 'number',
  139. 'default' => 45,
  140. ),
  141. 'postsToShow' => array(
  142. 'type' => 'number',
  143. 'default' => 4,
  144. ),
  145. 'excerptLength' => array(
  146. 'type' => 'number',
  147. 'default' => 55,
  148. ),
  149.  
  150. //Seperator
  151. 'showSeparator' => array(
  152. 'type' => 'boolean',
  153. 'default' => true
  154. ),
  155.  
  156. 'separatorColor' => array(
  157. 'type' => 'string',
  158. 'default' => '#e5e5e5',
  159. 'style' => [(object) [
  160. 'condition' => [
  161. (object) ['key' => 'style', 'relation' => '==', 'value' => 1],
  162. (object) ['key' => 'showSeparator', 'relation' => '==', 'value' => true]
  163. ],
  164. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-1:not(:last-child) {border-bottom-color: {{separatorColor}};}'
  165. ]]
  166. ),
  167.  
  168. 'separatorHeight' => array(
  169. 'type' => 'object',
  170. 'default' => (object) array(
  171. 'md' => 1,
  172. 'unit' => 'px'
  173. ),
  174. 'style' => [
  175. (object) [
  176. 'condition' => [
  177. (object) ['key' => 'style', 'relation' => '==', 'value' => 1],
  178. (object) ['key' => 'showSeparator', 'relation' => '==', 'value' => true]
  179. ],
  180. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-1:not(:last-child){border-bottom-style: solid;border-bottom-width: {{separatorHeight}};}'
  181. ],
  182. ],
  183. ),
  184.  
  185. 'separatorSpace' => array(
  186. 'type' => 'object',
  187. 'default' => (object) array(
  188. 'md' => 20,
  189. 'unit' => 'px'
  190. ),
  191. 'style' => [
  192. (object) [
  193. 'condition' => [
  194. (object) ['key' => 'style', 'relation' => '==', 'value' => 1],
  195. (object) ['key' => 'showSeparator', 'relation' => '==', 'value' => true]
  196. ],
  197. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-1:not(:last-child){padding-bottom: {{separatorSpace}};margin-bottom: {{separatorSpace}};}'
  198. ],
  199. ],
  200. ),
  201.  
  202.  
  203. //card
  204. 'cardBackground' => array(
  205. 'type' => 'object',
  206. 'default' => (object) [],
  207. 'style' => [
  208. (object) [
  209. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 2]],
  210. 'selector' => '{{QUBELY}} .qubely-postgrid-style-2'
  211. ]
  212. ]
  213. ),
  214. 'cardBorder' => array(
  215. 'type' => 'object',
  216. 'default' => (object) array(
  217. 'unit' => 'px',
  218. 'widthType' => 'global',
  219. 'global' => (object) array(
  220. 'md' => '1',
  221. ),
  222. ),
  223. 'style' => [
  224. (object) [
  225. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 2]],
  226. 'selector' => '{{QUBELY}} .qubely-postgrid-style-2'
  227. ]
  228. ]
  229. ),
  230. 'cardBorderRadius' => array(
  231. 'type' => 'object',
  232. 'default' => (object) array(
  233. 'unit' => 'px',
  234. 'openBorderRadius' => true,
  235. 'radiusType' => 'global',
  236. 'global' => (object) array(
  237. 'md' => 10,
  238. ),
  239. ),
  240. 'style' => [
  241. (object) [
  242. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 2]],
  243. 'selector' => '{{QUBELY}} .qubely-postgrid-style-2'
  244. ]
  245. ]
  246. ),
  247. 'cardSpace' => array(
  248. 'type' => 'object',
  249. 'default' => (object) array(
  250. 'md' => 25,
  251. 'unit' => 'px'
  252. ),
  253. 'style' => [
  254. (object) [
  255. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 2]],
  256. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-2:not(:last-child) {margin-bottom: {{cardSpace}};}'
  257. ]
  258. ]
  259. ),
  260. 'cardPadding' => array(
  261. 'type' => 'object',
  262. 'default' => (object) [
  263. 'openPadding' => 1,
  264. 'paddingType' => 'global',
  265. 'unit' => 'px',
  266. 'global' => (object) ['md' => 25],
  267. ],
  268. 'style' => [
  269. (object) [
  270. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 2]],
  271. 'selector' => '{{QUBELY}} .qubely-postgrid-style-2'
  272. ]
  273. ]
  274. ),
  275. 'cardBoxShadow' => array(
  276. 'type' => 'object',
  277. 'default' => (object) array(
  278. 'blur' => 8,
  279. 'color' => "rgba(0,0,0,0.10)",
  280. 'horizontal' => 0,
  281. 'inset' => 0,
  282. 'openShadow' => true,
  283. 'spread' => 0,
  284. 'vertical' => 4
  285. ),
  286. 'style' => [
  287. (object) [
  288. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 2]],
  289. 'selector' => '{{QUBELY}} .qubely-postgrid-style-2'
  290. ]
  291. ]
  292. ),
  293.  
  294. //scart
  295. 'stackBg' => array(
  296. 'type' => 'object',
  297. 'default' => (object) [],
  298. 'style' => [
  299. (object) [
  300. 'condition' => [
  301. (object) ['key' => 'layout', 'relation' => '==', 'value' => 1],
  302. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  303. ],
  304. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-3 .qubely-post-list-wrapper .qubely-post-list-content'
  305. ],
  306. (object) [
  307. 'condition' => [
  308. (object) ['key' => 'layout', 'relation' => '==', 'value' => 2],
  309. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  310. ],
  311. 'selector' => '{{QUBELY}} .qubely-post-grid-view.qubely-postgrid-style-3 .qubely-post-grid-content'
  312. ]
  313. ]
  314. ),
  315. 'stackBorderRadius' => array(
  316. 'type' => 'object',
  317. 'default' => (object) array(
  318. 'unit' => 'px',
  319. 'openBorderRadius' => true,
  320. 'radiusType' => 'global',
  321. 'global' => (object) array(
  322. 'md' => 10,
  323. ),
  324. ),
  325. 'style' => [
  326. (object) [
  327. 'condition' => [
  328. (object) ['key' => 'layout', 'relation' => '==', 'value' => 1],
  329. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  330. ],
  331. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-3 .qubely-post-list-wrapper .qubely-post-list-content'
  332. ],
  333. (object) [
  334. 'condition' => [
  335. (object) ['key' => 'layout', 'relation' => '==', 'value' => 2],
  336. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  337. ],
  338. 'selector' => '{{QUBELY}} .qubely-post-grid-view.qubely-postgrid-style-3 .qubely-post-grid-content'
  339. ]
  340. ]
  341. ),
  342. 'stackWidth' => array(
  343. 'type' => 'object',
  344. 'default' => (object) array(),
  345.  
  346. 'style' => [
  347. (object) [
  348. 'condition' => [
  349. (object) ['key' => 'layout', 'relation' => '==', 'value' => 2],
  350. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  351. ],
  352. 'selector' => '{{QUBELY}} .qubely-post-grid-view.qubely-postgrid-style-3 .qubely-post-grid-img + .qubely-post-grid-content {width: {{stackWidth}};}'
  353. ]
  354. ]
  355. ),
  356. 'stackSpace' => array(
  357. 'type' => 'object',
  358. 'default' => (object) array(
  359. 'md' => 40,
  360. 'unit' => 'px'
  361. ),
  362. 'style' => [
  363. (object) [
  364. 'condition' => [
  365. (object) ['key' => 'layout', 'relation' => '==', 'value' => 1],
  366. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  367. ],
  368. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-3:not(:last-child) {margin-bottom: {{stackSpace}};}'
  369. ]
  370. ]
  371.  
  372. ),
  373. 'stackPadding' => array(
  374. 'type' => 'object',
  375. 'default' => (object) [
  376. 'openPadding' => 1,
  377. 'paddingType' => 'global',
  378. 'unit' => 'px',
  379. 'global' => (object) ['md' => 30],
  380. ],
  381. 'style' => [
  382. (object) [
  383. 'condition' => [
  384. (object) ['key' => 'layout', 'relation' => '==', 'value' => 1],
  385. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  386. ],
  387. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-3 .qubely-post-list-wrapper .qubely-post-list-content'
  388. ],
  389. (object) [
  390. 'condition' => [
  391. (object) ['key' => 'layout', 'relation' => '==', 'value' => 2],
  392. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  393. ],
  394. 'selector' => '{{QUBELY}} .qubely-post-grid-view.qubely-postgrid-style-3 .qubely-post-grid-wrapper .qubely-post-grid-content'
  395. ]
  396. ]
  397. ),
  398. 'stackBoxShadow' => array(
  399. 'type' => 'object',
  400. 'default' => (object) array(
  401. 'blur' => 28,
  402. 'color' => "rgba(0,0,0,0.15)",
  403. 'horizontal' => 0,
  404. 'inset' => 0,
  405. 'openShadow' => true,
  406. 'spread' => -20,
  407. 'vertical' => 34
  408. ),
  409. 'style' => [
  410. (object) [
  411. 'condition' => [
  412. (object) ['key' => 'layout', 'relation' => '==', 'value' => 1],
  413. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  414. ],
  415. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-3 .qubely-post-list-wrapper .qubely-post-list-content'
  416. ],
  417. (object) [
  418. 'condition' => [
  419. (object) ['key' => 'layout', 'relation' => '==', 'value' => 2],
  420. (object) ['key' => 'style', 'relation' => '==', 'value' => 3]
  421. ],
  422. 'selector' => '{{QUBELY}} .qubely-post-grid-view.qubely-postgrid-style-3 .qubely-post-grid-content'
  423. ]
  424. ]
  425. ),
  426.  
  427. //typography
  428. 'titleTypography' => array(
  429. 'type' => 'object',
  430. 'default' => (object) [
  431. 'openTypography' => 1,
  432. 'family' => "Roboto",
  433. 'type' => "sans-serif",
  434. 'size' => (object) ['md' => 32, 'unit' => 'px'],
  435. ],
  436. 'style' => [(object) [
  437. 'condition' => [(object) ['key' => 'showTitle', 'relation' => '==', 'value' => true]],
  438. 'selector' => '{{QUBELY}} .qubely-postgrid-title'
  439. ]]
  440. ),
  441. 'metaTypography' => array(
  442. 'type' => 'object',
  443. 'default' => (object) [
  444. 'openTypography' => 1,
  445. 'family' => "Roboto",
  446. 'type' => "sans-serif",
  447. 'size' => (object) ['md' => 12, 'unit' => 'px'],
  448. ],
  449. 'condition' => [
  450. (object) ['key' => 'showAuthor', 'relation' => '==', 'value' => true],
  451. (object) ['key' => 'showDates', 'relation' => '==', 'value' => true],
  452. (object) ['key' => 'showComment', 'relation' => '==', 'value' => true]
  453. ],
  454. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-postgrid-meta']]
  455. ),
  456. 'excerptTypography' => array(
  457. 'type' => 'object',
  458. 'default' => (object) [
  459. 'openTypography' => 1,
  460. 'family' => "Roboto",
  461. 'type' => "sans-serif",
  462. 'size' => (object) ['md' => 16, 'unit' => 'px'],
  463. ],
  464. 'style' => [(object) [
  465. 'condition' => [(object) ['key' => 'showExcerpt', 'relation' => '==', 'value' => true]],
  466. 'selector' => '{{QUBELY}} .qubely-postgrid-intro, {{QUBELY}} .qubely-postgrid-intro p'
  467. ]]
  468. ),
  469. 'categoryTypography' => array(
  470. 'type' => 'object',
  471. 'default' => (object) [
  472. 'openTypography' => 1,
  473. 'family' => "Roboto",
  474. 'type' => "sans-serif",
  475. 'size' => (object) ['md' => 12, 'unit' => 'px'], 'spacing' => (object) ['md' => 1.1, 'unit' => 'px'], 'transform' => 'uppercase'
  476. ],
  477. 'style' => [(object) [
  478. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '!=', 'value' => 'none']],
  479. 'selector' => '{{QUBELY}} .qubely-postgrid-category a'
  480. ]]
  481. ),
  482.  
  483. //image
  484. 'showImages' => array(
  485. 'type' => 'boolean',
  486. 'default' => true
  487. ),
  488. 'enableFixedHeight' => array(
  489. 'type' => 'boolean',
  490. 'default' => true
  491. ),
  492. 'fixedHeight' => array(
  493. 'type' => 'object',
  494. 'default' => (object) array(),
  495. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-post-image{object-fit: cover;height: {{fixedHeight}};}']]
  496. ),
  497. 'imgSize' => array(
  498. 'type' => 'string',
  499. 'default' => 'large',
  500. ),
  501. 'imageRadius' => array(
  502. 'type' => 'object',
  503. 'default' => (object) array(
  504. 'unit' => 'px',
  505. 'openBorderRadius' => true,
  506. 'radiusType' => 'global',
  507. 'global' => (object) array(
  508. 'md' => 10,
  509. ),
  510. ),
  511. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-post-img']]
  512. ),
  513. 'imageAnimation' => array(
  514. 'type' => 'string',
  515. 'default' => 'zoom-out'
  516. ),
  517.  
  518. //readmore link
  519. 'buttonText' => array(
  520. 'type' => 'string',
  521. 'default' => 'Read More'
  522. ),
  523. 'readmoreStyle' => array(
  524. 'type' => 'string',
  525. 'default' => 'fill'
  526. ),
  527. 'readmoreSize' => array(
  528. 'type' => 'string',
  529. 'default' => 'small'
  530. ),
  531. 'readmoreCustomSize' => array(
  532. 'type' => 'object',
  533. 'default' => (object) [
  534. 'openPadding' => 1,
  535. 'paddingType' => 'custom',
  536. 'unit' => 'px',
  537. 'custom' => (object) ['md' => '5 10 5 10'],
  538. ],
  539. 'style' => [(object) [
  540. 'condition' => [
  541. (object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'fill'],
  542. (object) ['key' => 'readmoreSize', 'relation' => '==', 'value' => 'custom']
  543. ],
  544. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-postgrid-btn-wrapper .qubely-postgrid-btn.qubely-button-fill.is-custom'
  545. ]]
  546. ),
  547.  
  548. 'readmoreTypography' => array(
  549. 'type' => 'object',
  550. 'default' => (object) [
  551. 'openTypography' => 1,
  552. 'family' => "Roboto",
  553. 'type' => "sans-serif",
  554. 'size' => (object) ['md' => 14, 'unit' => 'px'],
  555. ],
  556. 'style' => [(object) [
  557. 'condition' => [(object) ['key' => 'showTitle', 'relation' => '==', 'value' => true]],
  558. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-postgrid-btn'
  559. ]]
  560. ),
  561. 'readmoreColor' => array(
  562. 'type' => 'string',
  563. 'default' => '#fff',
  564. 'style' => [(object) [
  565. 'condition' => [
  566. (object) ['key' => 'showReadMore', 'relation' => '==', 'value' => true],
  567. (object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'fill']
  568. ],
  569. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid a.qubely-postgrid-btn {color: {{readmoreColor}};}'
  570. ]]
  571.  
  572. ),
  573. 'readmoreColor2' => array(
  574. 'type' => 'string',
  575. 'default' => '#2184F9',
  576. 'style' => [(object) [
  577. 'condition' => [
  578. (object) ['key' => 'showReadMore', 'relation' => '==', 'value' => true],
  579. (object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'outline']
  580. ],
  581. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid a.qubely-postgrid-btn {color: {{readmoreColor2}};}'
  582. ]]
  583.  
  584. ),
  585. 'readmoreHoverColor' => array(
  586. 'type' => 'string',
  587. 'default' => '',
  588. 'style' => [(object) [
  589. 'condition' => [(object) ['key' => 'showReadMore', 'relation' => '==', 'value' => true]],
  590. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid a.qubely-postgrid-btn:hover {color: {{readmoreHoverColor}};}'
  591. ]]
  592.  
  593. ),
  594. 'readmoreBg' => array(
  595. 'type' => 'object',
  596. 'default' => (object) array(
  597. 'openColor' => 1,
  598. 'type' => 'color',
  599. 'color' => '#2184F9',
  600. 'gradient' => (object) [
  601. 'color1' => '#16d03e',
  602. 'color2' => '#1f91f3',
  603. 'direction' => 45,
  604. 'start' => 0,
  605. 'stop' => 100,
  606. 'type' => 'linear'
  607. ],
  608. ),
  609. 'style' => [(object) [
  610. 'condition' => [(object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'fill']],
  611. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-postgrid-btn'
  612. ]]
  613. ),
  614. 'readmoreHoverBg' => array(
  615. 'type' => 'object',
  616. 'default' => (object) array(),
  617. 'style' => [(object) [
  618. 'condition' => [(object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'fill']],
  619. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-postgrid-btn:hover'
  620. ]]
  621. ),
  622. 'readmoreBorder' => array(
  623. 'type' => 'object',
  624. 'default' => (object) array(),
  625. 'style' => [(object) [
  626. 'condition' => [(object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'fill']],
  627. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-postgrid-btn'
  628. ]]
  629. ),
  630. 'readmoreBorderRadius' => array(
  631. 'type' => 'object',
  632. 'default' => (object) array(
  633. 'unit' => 'px',
  634. 'openBorderRadius' => true,
  635. 'radiusType' => 'global',
  636. 'global' => (object) array(
  637. 'md' => 2,
  638. ),
  639. ),
  640. 'style' => [(object) [
  641. 'condition' => [(object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'fill']],
  642. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-postgrid-btn'
  643. ]]
  644. ),
  645. 'readmoreBoxShadow' => array(
  646. 'type' => 'object',
  647. 'default' => (object) array(),
  648. 'style' => [(object) [
  649. 'condition' => [(object) ['key' => 'readmoreStyle', 'relation' => '==', 'value' => 'fill']],
  650. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-postgrid-btn'
  651. ]]
  652. ),
  653.  
  654. //color
  655. 'categoryPadding' => array(
  656. 'type' => 'object',
  657. 'default' => (object) array(
  658. 'unit' => 'px',
  659. 'openPadding' => true,
  660. 'paddingType' => 'custom',
  661. 'custom' => (object) array(
  662. 'md' => '4 8 4 8',
  663. ),
  664. ),
  665. 'style' => [(object) [
  666. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'badge']],
  667. 'selector' => '{{QUBELY}} .qubely-postgrid-category a'
  668. ]]
  669. ),
  670. 'contentPadding' => array(
  671. 'type' => 'object',
  672. 'default' => (object) array(),
  673. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-post-grid-content,{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-post-list-content']]
  674. ),
  675. 'categoryRadius' => array(
  676. 'type' => 'object',
  677. 'default' => (object) array(
  678. 'unit' => 'px',
  679. 'openBorderRadius' => true,
  680. 'radiusType' => 'global',
  681. 'global' => (object) array(
  682. 'md' => 2,
  683. ),
  684. ),
  685. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-postgrid-category a']]
  686. ),
  687. 'titleColor' => array(
  688. 'type' => 'string',
  689. 'default' => '#1b1b1b',
  690. 'style' => [(object) [
  691. 'condition' => [
  692. (object) ['key' => 'style', 'relation' => '!=', 'value' => 4],
  693. (object) ['key' => 'showTitle', 'relation' => '==', 'value' => true]
  694. ],
  695. 'selector' => '{{QUBELY}} .qubely-postgrid-title a {color: {{titleColor}};}'
  696. ]]
  697. ),
  698. 'titleOverlayColor' => array(
  699. 'type' => 'string',
  700. 'default' => '#fff',
  701. 'style' => [(object) [
  702. 'condition' => [
  703. (object) ['key' => 'style', 'relation' => '==', 'value' => 4],
  704. (object) ['key' => 'showTitle', 'relation' => '==', 'value' => true]
  705. ],
  706. 'selector' => '{{QUBELY}} .qubely-postgrid-title a {color: {{titleOverlayColor}};}'
  707. ]]
  708. ),
  709. 'titleHoverColor' => array(
  710. 'type' => 'string',
  711. 'default' => '#FF0096',
  712. 'style' => [(object) [
  713. 'condition' => [(object) ['key' => 'showTitle', 'relation' => '==', 'value' => true]],
  714. 'selector' => '{{QUBELY}} .qubely-postgrid-title a:hover {color: {{titleHoverColor}};}'
  715. ]]
  716. ),
  717. 'categoryColor' => array(
  718. 'type' => 'string',
  719. 'default' => '#FF0096',
  720. 'style' => [(object) [
  721. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'default']],
  722. 'selector' => '{{QUBELY}} .qubely-postgrid-category a {color: {{categoryColor}};}'
  723. ]]
  724. ),
  725. 'categoryColor2' => array(
  726. 'type' => 'string',
  727. 'default' => '#fff',
  728. 'style' => [(object) [
  729. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'badge']],
  730. 'selector' => '{{QUBELY}} .qubely-postgrid-category a {color: {{categoryColor2}};}'
  731. ]]
  732. ),
  733. 'categoryHoverColor' => array(
  734. 'type' => 'string',
  735. 'default' => '#FF0096',
  736. 'style' => [(object) [
  737. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'default']],
  738. 'selector' => '{{QUBELY}} .qubely-postgrid-category a:hover {color: {{categoryHoverColor}};}'
  739. ]]
  740. ),
  741. 'categoryBackground' => array(
  742. 'type' => 'string',
  743. 'default' => '#FF0096',
  744. 'style' => [(object) [
  745. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'badge']],
  746. 'selector' => '{{QUBELY}} .qubely-postgrid-category a {background: {{categoryBackground}};}'
  747. ]]
  748. ),
  749. 'categoryHoverBackground' => array(
  750. 'type' => 'string',
  751. 'default' => '#e00e89',
  752. 'style' => [(object) [
  753. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'badge']],
  754. 'selector' => '{{QUBELY}} .qubely-postgrid-category a:hover {background: {{categoryHoverBackground}};}'
  755. ]]
  756. ),
  757.  
  758. 'categoryHoverColor2' => array(
  759. 'type' => 'string',
  760. 'default' => '#fff',
  761. 'style' => [(object) [
  762. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'badge']],
  763. 'selector' => '{{QUBELY}} .qubely-postgrid-category a:hover {color: {{categoryHoverColor2}};}'
  764. ]]
  765. ),
  766. 'metaColor' => array(
  767. 'type' => 'string',
  768. 'default' => '#9B9B9B',
  769. 'style' => [(object) [
  770. 'condition' => [
  771. (object) ['key' => 'style', 'relation' => '!=', 'value' => 4]
  772. ],
  773. 'selector' => '{{QUBELY}} .qubely-postgrid-meta a {color: {{metaColor}};} {{QUBELY}} .qubely-postgrid-meta {color: {{metaColor}};} {{QUBELY}} .qubely-postgrid-meta span:before {background: {{metaColor}};}'
  774. ]]
  775. ),
  776. 'metaOverlayColor' => array(
  777. 'type' => 'string',
  778. 'default' => '#fff',
  779. 'style' => [(object) [
  780. 'condition' => [
  781. (object) ['key' => 'style', 'relation' => '==', 'value' => 4]
  782. ],
  783. 'selector' => '{{QUBELY}} .qubely-postgrid-meta a {color: {{metaOverlayColor}};} {{QUBELY}} .qubely-postgrid-meta {color: {{metaOverlayColor}};} {{QUBELY}} .qubely-postgrid-meta span:before {background: {{metaOverlayColor}};}'
  784. ]]
  785. ),
  786. 'excerptColor' => array(
  787. 'type' => 'string',
  788. 'default' => '#9B9B9B',
  789. 'style' => [(object) [
  790. 'condition' => [
  791. (object) ['key' => 'style', 'relation' => '!=', 'value' => 4],
  792. (object) ['key' => 'showExcerpt', 'relation' => '==', 'value' => true]
  793. ],
  794. 'selector' => '{{QUBELY}} .qubely-postgrid-intro {color: {{excerptColor}};}'
  795. ]]
  796. ),
  797. 'excerptColor2' => array(
  798. 'type' => 'string',
  799. 'default' => '#fff',
  800. 'style' => [(object) [
  801. 'condition' => [
  802. (object) ['key' => 'style', 'relation' => '==', 'value' => 4],
  803. (object) ['key' => 'showExcerpt', 'relation' => '==', 'value' => true]
  804. ],
  805. 'selector' => '{{QUBELY}} .qubely-postgrid-intro {color: {{excerptColor2}};}'
  806. ]]
  807. ),
  808.  
  809. //design
  810. 'spacer' => array(
  811. 'type' => 'object',
  812. 'default' => (object) array(
  813. 'spaceTop' => (object) ['md' => '10', 'unit' => "px"],
  814. 'spaceBottom' => (object) ['md' => '10', 'unit' => "px"],
  815. ),
  816. 'style' => [(object) ['selector' => '{{QUBELY}}']]
  817. ),
  818. 'contentPosition' => array(
  819. 'type' => 'string',
  820. 'default' => 'center',
  821. ),
  822. 'girdContentPosition' => array(
  823. 'type' => 'string',
  824. 'default' => 'center',
  825. ),
  826. 'color' => array(
  827. 'type' => 'string',
  828. 'default' => '',
  829. 'style' => [(object) [
  830. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 1]],
  831. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid .qubely-post-list-content {color: {{color}};}'
  832. ]]
  833. ),
  834. 'bgColor' => array(
  835. 'type' => 'object',
  836. 'default' => (object) array(),
  837. 'style' => [(object) [
  838. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 1]],
  839. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper'
  840. ]]
  841. ),
  842. 'border' => array(
  843. 'type' => 'object',
  844. 'default' => (object) array(),
  845. 'style' => [(object) [
  846. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 1]],
  847. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper'
  848. ]]
  849. ),
  850. 'borderRadius' => array(
  851. 'type' => 'object',
  852. 'default' => (object) array(),
  853. 'style' => [(object) [
  854. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 1]],
  855. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper'
  856. ]]
  857. ),
  858. 'padding' => array(
  859. 'type' => 'object',
  860. 'default' => (object) array(),
  861. 'style' => [(object) [
  862. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 1]],
  863. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper'
  864. ]]
  865. ),
  866. 'boxShadow' => array(
  867. 'type' => 'object',
  868. 'default' => (object) array(),
  869. 'style' => [(object) [
  870. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 1]],
  871. 'selector' => '{{QUBELY}} .qubely-postgrid-wrapper'
  872. ]]
  873. ),
  874.  
  875. //overlay
  876. 'overlayBg' => array(
  877. 'type' => 'object',
  878. 'default' => (object) [
  879. 'openColor' => 1,
  880. 'type' => 'color',
  881. 'color' => '#101a3b',
  882. 'gradient' => (object) [
  883. 'color1' => '#071b0b',
  884. 'color2' => '#101a3b',
  885. 'direction' => 45,
  886. 'start' => 0,
  887. 'stop' => 100,
  888. 'type' => 'linear'
  889. ],
  890. ],
  891. 'style' => [(object) [
  892. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 4]],
  893. 'selector' => '{{QUBELY}} .qubely-postgrid-style-4:before'
  894. ]]
  895. ),
  896. 'overlayHoverBg' => array(
  897. 'type' => 'object',
  898. 'default' => (object) [
  899. 'openColor' => 1,
  900. 'type' => 'color',
  901. 'color' => '#4c4e54',
  902. 'gradient' => (object) [
  903. 'color1' => '#4c4e54',
  904. 'color2' => '#071b0b',
  905. 'direction' => 45,
  906. 'start' => 0,
  907. 'stop' => 100,
  908. 'type' => 'linear'
  909. ],
  910. ],
  911. 'style' => [(object) [
  912. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 4]],
  913. 'selector' => '{{QUBELY}} .qubely-postgrid-style-4:hover:before'
  914. ]]
  915. ),
  916. 'overlayBorderRadius' => array(
  917. 'type' => 'object',
  918. 'default' => (object) array(
  919. 'unit' => 'px',
  920. 'openBorderRadius' => true,
  921. 'radiusType' => 'global',
  922. 'global' => (object) array(
  923. 'md' => 20,
  924. ),
  925. ),
  926. 'style' => [
  927. (object) [
  928. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 4]],
  929. 'selector' => '{{QUBELY}} .qubely-postgrid-style-4'
  930. ]
  931. ]
  932. ),
  933. 'overlaySpace' => array(
  934. 'type' => 'object',
  935. 'default' => (object) array(
  936. 'md' => 30,
  937. 'unit' => 'px'
  938. ),
  939. 'style' => [
  940. (object) [
  941. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 4]],
  942. 'selector' => '{{QUBELY}} .qubely-post-list-view.qubely-postgrid-style-4:not(:last-child) {margin-bottom: {{overlaySpace}};}'
  943. ]
  944. ]
  945. ),
  946. 'overlayHeight' => array(
  947. 'type' => 'object',
  948. 'default' => (object) array(
  949. 'md' => 300,
  950. 'unit' => 'px'
  951. ),
  952. 'style' => [
  953. (object) [
  954. 'condition' => [
  955. (object) ['key' => 'style', 'relation' => '==', 'value' => 4]
  956. ],
  957. 'selector' => '{{QUBELY}} .qubely-postgrid-style-4 {height: {{overlayHeight}};}'
  958. ]
  959. ]
  960. ),
  961. 'overlayBlend' => array(
  962. 'type' => 'string',
  963. 'default' => '',
  964. 'style' => [(object) [
  965. 'condition' => [(object) ['key' => 'style', 'relation' => '==', 'value' => 4]],
  966. 'selector' => '{{QUBELY}} .qubely-postgrid.qubely-post-list-view.qubely-postgrid-style-4:before {mix-blend-mode: {{overlayBlend}};}'
  967. ]]
  968. ),
  969. //Spacing
  970. 'columnGap' => array(
  971. 'type' => 'object',
  972. 'default' => (object) array(
  973. 'md' => 30,
  974. 'unit' => 'px'
  975. ),
  976. 'style' => [(object) [
  977. 'condition' => [(object) ['key' => 'layout', 'relation' => '==', 'value' => 2]],
  978. 'selector' => '{{QUBELY}} .qubely-postgrid-column {grid-column-gap: {{columnGap}};}, {{QUBELY}} .qubely-postgrid-column {grid-row-gap: {{columnGap}};}'
  979. ]]
  980. ),
  981. 'titleSpace' => array(
  982. 'type' => 'object',
  983. 'default' => (object) array(
  984. 'md' => 10,
  985. 'unit' => 'px'
  986. ),
  987. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-postgrid-title {padding-bottom: {{titleSpace}};}']]
  988. ),
  989. 'categorySpace' => array(
  990. 'type' => 'object',
  991. 'default' => (object) array(
  992. 'md' => 5,
  993. 'unit' => 'px'
  994. ),
  995. 'style' => [(object) [
  996. 'condition' => [(object) ['key' => 'showCategory', 'relation' => '==', 'value' => 'default']],
  997. 'selector' => '{{QUBELY}} .qubely-postgrid-category {display:inline-block;padding-bottom: {{categorySpace}};}'
  998. ]]
  999. ),
  1000. 'metaSpace' => array(
  1001. 'type' => 'object',
  1002. 'default' => (object) array(
  1003. 'md' => 10,
  1004. 'unit' => 'px'
  1005. ),
  1006. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-postgrid-meta {padding-bottom: {{metaSpace}};}']]
  1007. ),
  1008. 'excerptSpace' => array(
  1009. 'type' => 'object',
  1010. 'default' => (object) array(
  1011. 'md' => 10,
  1012. 'unit' => 'px'
  1013. ),
  1014. 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-postgrid-intro {padding-bottom: {{excerptSpace}};}']]
  1015. ),
  1016. 'postSpace' => array(
  1017. 'type' => 'object',
  1018. 'default' => (object) array(
  1019. 'md' => 10,
  1020. 'unit' => 'px'
  1021. ),
  1022. // 'style' => [(object) ['selector' => '{{QUBELY}} .qubely-postgrid-wrapper .qubely-postgrid']]
  1023. ),
  1024. 'interaction' => array(
  1025. 'type' => 'object',
  1026. 'default' => (object) array(),
  1027. ),
  1028. 'animation' => array(
  1029. 'type' => 'object',
  1030. 'default' => (object) array(),
  1031. ),
  1032. 'globalZindex' => array(
  1033. 'type' => 'string',
  1034. 'default' => '0',
  1035. 'style' => [(object) ['selector' => '{{QUBELY}} {z-index:{{globalZindex}};}']]
  1036. ),
  1037. 'hideTablet' => array(
  1038. 'type' => 'boolean',
  1039. 'default' => false,
  1040. 'style' => [(object) ['selector' => '{{QUBELY}}{display:none;}']]
  1041. ),
  1042. 'hideMobile' => array(
  1043. 'type' => 'boolean',
  1044. 'default' => false,
  1045. 'style' => [(object) ['selector' => '{{QUBELY}}{display:none;}']]
  1046. ),
  1047. 'globalCss' => array(
  1048. 'type' => 'string',
  1049. 'default' => '',
  1050. 'style' => [(object) ['selector' => '']]
  1051. ),
  1052. // 'showContextMenu' => array(
  1053. // 'type' => 'boolean',
  1054. // 'default' => true
  1055. // ),
  1056. ),
  1057. 'render_callback' => 'render_block_qubely_postgrid'
  1058. )
  1059. );
  1060. }
  1061.  
  1062. function render_block_qubely_postgrid($att)
  1063. {
  1064. $layout = isset($att['layout']) ? $att['layout'] : 3;
  1065. $uniqueId = isset($att['uniqueId']) ? $att['uniqueId'] : '';
  1066. $className = isset($att['className']) ? $att['className'] : '';
  1067. $style = isset($att['style']) ? $att['style'] : 3;
  1068. $column = isset($att['column']) ? $att['column'] : 3;
  1069. $numbers = isset($att['postsToShow']) ? $att['postsToShow'] : 3;
  1070. $limit = isset($att['excerptLimit']) ? $att['excerptLimit'] : 3;
  1071. $showCategory = isset($att['showCategory']) ? $att['showCategory'] : 'default';
  1072. $categoryPosition = isset($att['categoryPosition']) ? $att['categoryPosition'] : 'leftTop';
  1073. $contentPosition = isset($att['contentPosition']) ? $att['contentPosition'] : 'center';
  1074. $girdContentPosition = isset($att['girdContentPosition']) ? $att['girdContentPosition'] : 'center';
  1075. $showTitle = isset($att['showTitle']) ? $att['showTitle'] : 1;
  1076. $showAuthor = isset($att['showAuthor']) ? $att['showAuthor'] : 1;
  1077. $showDates = isset($att['showDates']) ? $att['showDates'] : 1;
  1078. $showComment = isset($att['showComment']) ? $att['showComment'] : 1;
  1079. $showExcerpt = isset($att['showExcerpt']) ? $att['showExcerpt'] : 1;
  1080. $showReadMore = isset($att['showReadMore']) ? $att['showReadMore'] : 1;
  1081. $buttonText = isset($att['buttonText']) ? $att['buttonText'] : 'Read More';
  1082. $readmoreSize = isset($att['readmoreSize']) ? $att['readmoreSize'] : 'small';
  1083. $readmoreStyle = isset($att['readmoreStyle']) ? $att['readmoreStyle'] : 'fill';
  1084. $showImages = isset($att['showImages']) ? $att['showImages'] : 1;
  1085. $imgSize = isset($att['imgSize']) ? $att['imgSize'] : 'large';
  1086. $showBadge = isset($att['showBadge']) ? $att['showBadge'] : 1;
  1087. $order = isset($att['order']) ? $att['order'] : 'DESC';
  1088. $imageAnimation = isset($att['imageAnimation']) ? $att['imageAnimation'] : '';
  1089. $orderBy = isset($att['orderBy']) ? $att['orderBy'] : 'date';
  1090. $categories = $att['categories'];
  1091. $tags = $att['tags'];
  1092. $taxonomy = $att['taxonomy'];
  1093.  
  1094. $animation = isset($att['animation']) ? ( count((array)$att['animation']) > 0 && $att['animation']['animation'] ? 'data-qubelyanimation="'.htmlspecialchars(json_encode($att['animation']), ENT_QUOTES, 'UTF-8').'"' : '' ) : '';
  1095.  
  1096.  
  1097. $interaction = '';
  1098. if(isset($att['interaction'])) {
  1099. if (!empty((array)$att['interaction'])) {
  1100. if(isset($att['interaction']['while_scroll_into_view'])) {
  1101. if($att['interaction']['while_scroll_into_view']['enable']){
  1102. $interaction = 'qubley-block-interaction';
  1103. }
  1104. }
  1105. if(isset($att['interaction']['mouse_movement'])) {
  1106. if($att['interaction']['mouse_movement']['enable']) {
  1107. $interaction = 'qubley-block-interaction';
  1108. }
  1109. }
  1110. }
  1111. }
  1112.  
  1113.  
  1114. $args = array(
  1115. 'post_type' => 'post',
  1116. 'posts_per_page' => esc_attr($numbers),
  1117. 'order' => esc_attr($order),
  1118. 'orderby' => esc_attr($orderBy),
  1119. 'status' => 'publish',
  1120. );
  1121.  
  1122. $active_taxonomy_array = $att['taxonomy'] == 'categories' ? $categories : $tags;
  1123. $active_taxonomy_name = $att['taxonomy'] == 'categories' ? 'category__in' : 'tag__in';
  1124.  
  1125. if (is_array($active_taxonomy_array) && count($active_taxonomy_array) > 0) {
  1126. $args[$active_taxonomy_name] = array_column($active_taxonomy_array, 'value');
  1127. }
  1128.  
  1129. $query = new WP_Query($args);
  1130.  
  1131. # The Loop.
  1132. $html = '';
  1133. //excerpt;
  1134. if (!function_exists('qubely_excerpt_max_charlength')) :
  1135. function qubely_excerpt_max_charlength($limit)
  1136. {
  1137. $excerpt = get_the_excerpt();
  1138. if (str_word_count($excerpt, 0) > $limit) {
  1139. $words = str_word_count($excerpt, 2);
  1140. $pos = array_keys($words);
  1141. $text = substr($excerpt, 0, $pos[$limit]);
  1142. return $text;
  1143. }
  1144. return $excerpt;
  1145. }
  1146. endif;
  1147.  
  1148. //column
  1149. if ($layout == 2) {
  1150. $col = (' qubely-postgrid-column qubely-postgrid-column-md' . $column['md'] . ' qubely-postgrid-column-sm' . $column['sm'] . ' qubely-postgrid-column-xs' . $column['xs']);
  1151. } else {
  1152. $col = "";
  1153. }
  1154. $class = 'wp-block-qubely-postgrid qubely-block-'.$uniqueId;
  1155. if ( isset( $att['align'] ) ) {
  1156. $class .= ' align' . $att['align'];
  1157. }
  1158. if ( isset( $att['className'] ) ) {
  1159. $class .= $att['className'];
  1160. }
  1161.  
  1162. if ($query->have_posts()) {
  1163. $html .= '<div class="' . $class . '">';
  1164. $html .= '<div class="qubely-postgrid-wrapper '.$interaction.' qubely-postgrid-layout-' . esc_attr($layout) . esc_attr($col) . '" '.$animation.'>';
  1165. while ($query->have_posts()) {
  1166. $query->the_post();
  1167. $id = get_post_thumbnail_id();
  1168. var_dump(get_the_date());
  1169. $src = wp_get_attachment_image_src($id, $imgSize);
  1170. $image = '<img class="qubely-post-image" src="' . esc_url($src[0]) . '" alt="' . get_the_title() . '"/>';
  1171. $title = '<h3 class="qubely-postgrid-title"><a href="' . esc_url(get_the_permalink()) . '">' . get_the_title() . '</a></h3>';
  1172. $category = '<span class="qubely-postgrid-category">' . get_the_category_list(' ') . '</span>';
  1173. $meta = ($showAuthor == 1) ? '<span><i class="fas fa-user"></i> ' . __('By ', 'qubely') . get_the_author_posts_link() . '</span>' : '';
  1174. $meta .= ($showDates == 1) ? '<span><i class="far fa-calendar-alt"></i> ' . date_i18n(get_option('date_format'), strtotime(get_the_date())) . '</span>' : '';
  1175. $meta .= ($showComment == 1) ? '<span><i class="fas fa-comment"></i> ' . get_comments_number('0', '1', '%') . '</span>' : '';
  1176. $btn = '<div class="qubely-postgrid-btn-wrapper"><a class="qubely-postgrid-btn qubely-button-' . esc_attr($readmoreStyle) . ' is-' . esc_attr($readmoreSize) . '" href="' . esc_url(get_the_permalink()) . '">' . esc_attr($buttonText) . '</a></div>';
  1177. $excerpt = '<div class="qubely-postgrid-intro">' . qubely_excerpt_max_charlength(esc_attr($limit)) . '</div>';
  1178.  
  1179. if ($layout === 1) {
  1180. $html .= '<div class="qubely-postgrid qubely-post-list-view qubely-postgrid-style-' . esc_attr($style) . '">';
  1181. $html .= '<div class="qubely-post-list-wrapper qubely-post-list-' . esc_attr(($layout == 2 && $style === 3) ? $contentPosition : $girdContentPosition) . '">';
  1182. if (($showImages == 1) && has_post_thumbnail()) {
  1183. $html .= '<div class="qubely-post-list-img qubely-post-img qubely-post-img-' . esc_attr($imageAnimation) . '">';
  1184. $html .= '<a href="' . esc_url(get_the_permalink()) . '">';
  1185. $html .= $image;
  1186. $html .= '</a>';
  1187. if ($showCategory == 'badge' && $style != 4) {
  1188. $html .= '<div class="qubely-postgrid-cat-position qubely-postgrid-cat-position-' . esc_attr($categoryPosition) . '">';
  1189. $html .= $category;
  1190. $html .= '</div>';
  1191. }
  1192. $html .= '</div>'; //qubely-post-list-img
  1193. }
  1194. $html .= '<div class="qubely-post-list-content">';
  1195. if ($showCategory == 'default') {
  1196. $html .= $category;
  1197. }
  1198.  
  1199. if ($showCategory == 'badge' && $style == 4) {
  1200. $html .= '<div class="qubely-postgrid-cat-position qubely-postgrid-cat-position-' . esc_attr($categoryPosition) . '">';
  1201. $html .= $category;
  1202. $html .= '</div>';
  1203. }
  1204.  
  1205. if ($showTitle == 1) {
  1206. $html .= $title;
  1207. }
  1208. if (($showAuthor == 1) || ($showDates == 1) || ($showComment == 1)) {
  1209. $html .= '<div class="qubely-postgrid-meta">';
  1210. $html .= $meta;
  1211. $html .= '</div>';
  1212. }
  1213. if ($showExcerpt == 1) {
  1214. $html .= $excerpt;
  1215. }
  1216. if ($showReadMore == 1) {
  1217. $html .= $btn;
  1218. }
  1219. $html .= '</div>'; //qubely-post-list-content
  1220. $html .= '</div>'; //qubely-post-list-wrap
  1221. $html .= '</div>'; //qubely-postgrid
  1222. }
  1223. if ($layout === 2) {
  1224. $html .= '<div class="qubely-postgrid qubely-post-grid-view qubely-postgrid-style-' . esc_attr($style) . '">';
  1225. $html .= '<div class="qubely-post-grid-wrapper qubely-post-grid-' . esc_attr(($layout == 2 && $style === 3) ? $contentPosition : $girdContentPosition) . '">';
  1226. if (($showImages == 1) && has_post_thumbnail()) {
  1227. $html .= '<div class="qubely-post-grid-img qubely-post-img qubely-post-img-' . esc_attr($imageAnimation) . '">';
  1228. $html .= '<a href="' . esc_url(get_the_permalink()) . '">';
  1229. $html .= $image;
  1230. $html .= '</a>';
  1231. if ($showCategory == 'badge' && $style != 4) {
  1232. $html .= '<div class="qubely-postgrid-cat-position qubely-postgrid-cat-position-' . esc_attr($categoryPosition) . '">';
  1233. $html .= $category;
  1234. $html .= '</div>';
  1235. }
  1236. $html .= '</div>'; //qubely-post-grid-img
  1237. }
  1238. $html .= '<div class="qubely-post-grid-content">';
  1239. if ($showCategory == 'default') {
  1240. $html .= $category;
  1241. }
  1242. if ($showCategory == 'badge' && $style == 4) {
  1243. $html .= '<div class="qubely-postgrid-cat-position qubely-postgrid-cat-position-' . esc_attr($categoryPosition) . '">';
  1244. $html .= $category;
  1245. $html .= '</div>';
  1246. }
  1247. if ($showTitle == 1) {
  1248. $html .= $title;
  1249. }
  1250. if (($showAuthor == 1) || ($showDates == 1) || ($showComment == 1)) {
  1251. $html .= '<div class="qubely-postgrid-meta">';
  1252. $html .= $meta;
  1253. $html .= '</div>';
  1254. }
  1255. if ($showExcerpt == 1) {
  1256. $html .= $excerpt;
  1257. }
  1258. if ($showReadMore == 1) {
  1259. $html .= $btn;
  1260. }
  1261. $html .= '</div>'; //qubely-post-grid-content
  1262. $html .= '</div>'; //qubely-post-grid-wrap
  1263. $html .= '</div>'; //qubely-postgrid
  1264. }
  1265. }
  1266. $html .= '</div>';
  1267. $html .= '</div>';
  1268. wp_reset_postdata();
  1269. }
  1270. return $html;
  1271. }
  1272. if (!defined('QUBELY_PRO_VERSION')) {
  1273. add_action('init', 'register_block_qubely_postgrid', 100);
  1274. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement