← All changes
|
inc/latest-post-block/posts-express-grid/index.php
+653
-348
2.5.3
→
5.0.1
View file →
| @@ -1,378 +1,683 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - if(!function_exists('blockspare_render_block_core_latest_posts_express_grid')){ | |
| 4 | - function blockspare_render_block_core_latest_posts_express_grid($attributes) | |
| 5 | - { | |
| 2 | +if (!function_exists('blockspare_latest_posts_style_control')) { | |
| 6 | 3 | |
| 7 | - ob_start(); | |
| 8 | - $unq_class = mt_rand(100000,999999); | |
| 9 | - $blockuniqueclass = ''; | |
| 10 | - | |
| 11 | - if(!empty($attributes['uniqueClass'])){ | |
| 12 | - $blockuniqueclass = $attributes['uniqueClass']; | |
| 13 | - }else{ | |
| 14 | - $blockuniqueclass = 'blockspare-posts-block-list-'.$unq_class; | |
| 15 | - } | |
| 4 | + function blockspare_latest_posts_style_control($blockuniqueclass, $attributes) | |
| 5 | + { | |
| 16 | 6 | |
| 17 | - $design = 'blockspare-posts-block-latestpost-express-grid '; | |
| 18 | - | |
| 19 | - | |
| 20 | - $block_class = 'blockspare-posts-block-is-express'. ' has-gutter-'.$attributes['gutterSpace']; | |
| 21 | - if($attributes['enableEqualHeight']){ | |
| 22 | - $block_class .= ' bs-has-equal-height'; | |
| 23 | - } | |
| 24 | - | |
| 25 | - if($attributes['displaySpotLightExceprt']){ | |
| 26 | - $block_class .= ' has-spotlight-excerpt '; | |
| 27 | - } | |
| 28 | - $design .= $attributes['express']; | |
| 29 | - $blockName= 'express'; | |
| 30 | - | |
| 31 | - blockspare_query_loop_and_wrapper($attributes,$block_class,$design,$blockName); | |
| 32 | - $data_content = blockspare_latest_posts_style_control($blockuniqueclass ,$attributes); | |
| 33 | - $data_content .= ob_get_clean(); | |
| 34 | - return $data_content; | |
| 35 | - | |
| 36 | - | |
| 37 | - } | |
| 38 | -} | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * Registers the post grid block on server | |
| 42 | - */ | |
| 43 | 7 | |
| 44 | - if(!function_exists('blockspare_register_block_core_latest_posts_express_grid')){ | |
| 45 | - function blockspare_register_block_core_latest_posts_express_grid() | |
| 46 | - { | |
| 47 | - | |
| 48 | - if (!function_exists('register_block_type')) { | |
| 49 | - return; | |
| 50 | - } | |
| 51 | - | |
| 52 | - | |
| 53 | - ob_start(); | |
| 54 | - include BLOCKSPARE_PLUGIN_DIR . 'inc/latest-post-block/posts-express-grid/block.json'; | |
| 55 | - $metadata = json_decode(ob_get_clean(), true); | |
| 56 | - | |
| 57 | - /* Block attributes */ | |
| 58 | - register_block_type( | |
| 59 | - 'blockspare/latest-posts-express-grid', | |
| 60 | - array( | |
| 61 | - 'attributes' =>$metadata['attributes'], | |
| 62 | - 'render_callback' => 'blockspare_render_block_core_latest_posts_express_grid', | |
| 63 | - ) | |
| 64 | - ); | |
| 65 | - } | |
| 66 | - | |
| 67 | - add_action('init', 'blockspare_register_block_core_latest_posts_express_grid'); | |
| 68 | -} | |
| 69 | - | |
| 8 | + // Build CSS separately | |
| 9 | + $inline_css = ''; | |
| 10 | + $inline_css .= blockspare_visibility_css($attributes, $blockuniqueclass); | |
| 11 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-wrap{ | |
| 12 | + margin-top:' . $attributes['marginTop'] . 'px; | |
| 13 | + margin-bottom:' . $attributes['marginBottom'] . 'px; | |
| 14 | + margin-left:' . $attributes['marginLeft'] . 'px; | |
| 15 | + margin-right:' . $attributes['marginRight'] . 'px; | |
| 16 | + }'; | |
| 70 | 17 | |
| 71 | - if(!function_exists('blockspare_latest_posts_style_control')){ | |
| 72 | - | |
| 73 | - function blockspare_latest_posts_style_control($blockuniqueclass ,$attributes){ | |
| 74 | - | |
| 75 | - $block_content =''; | |
| 76 | - $block_content .= '<style type="text/css">'; | |
| 77 | - $block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-latest-post-wrap{ | |
| 78 | - margin-top:' . $attributes['marginTop'] . 'px; | |
| 79 | - margin-bottom:' . $attributes['marginBottom'] . 'px; | |
| 80 | - margin-left:' . $attributes['marginLeft'] . 'px; | |
| 81 | - margin-right:' . $attributes['marginRight'] . 'px; | |
| 18 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ | |
| 19 | + padding-top:' . $attributes['contentPaddingTop'] . 'px; | |
| 20 | + padding-right:' . $attributes['contentPaddingRight'] . 'px; | |
| 21 | + padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; | |
| 22 | + padding-left:' . $attributes['contentPaddingLeft'] . 'px; | |
| 23 | + }'; | |
| 24 | + | |
| 25 | + $inline_css .= blockspare_posts_category_style( | |
| 26 | + $inline_css, | |
| 27 | + $attributes, | |
| 28 | + $blockuniqueclass, | |
| 29 | + $attributes['categoryTextColor'], | |
| 30 | + $attributes['categoryBackgroundColor'], | |
| 31 | + $attributes['categoryBorderColor'], | |
| 32 | + $attributes['secondCategoryTextColor'], | |
| 33 | + $attributes['secondCategoryBackgroundColor'], | |
| 34 | + $attributes['secondCategoryBorderColor'], | |
| 35 | + $attributes['thirdCategoryTextColor'], | |
| 36 | + $attributes['thirdCategoryBackgroundColor'], | |
| 37 | + $attributes['thirdCategoryBorderColor'], | |
| 38 | + ); | |
| 39 | + | |
| 40 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-byline{ | |
| 41 | + margin-top:' . $attributes['metaMarginTop'] . 'px' . '; | |
| 42 | + margin-bottom:' . $attributes['metaMarginBottom'] . 'px' . '; | |
| 43 | + margin-left:' . $attributes['metaMarginLeft'] . 'px' . '; | |
| 44 | + margin-right:' . $attributes['metaMarginRight'] . 'px' . '; | |
| 45 | + }'; | |
| 46 | + | |
| 47 | + | |
| 48 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link{ | |
| 49 | + margin-top:' . $attributes['moreLinkMarginTop'] . 'px' . '; | |
| 50 | + margin-bottom:' . $attributes['moreLinkMarginBottom'] . 'px' . '; | |
| 51 | + margin-left:' . $attributes['moreLinkMarginLeft'] . 'px' . '; | |
| 52 | + margin-right:' . $attributes['moreLinkMarginRight'] . 'px' . '; | |
| 53 | + }'; | |
| 54 | + | |
| 55 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 56 | + color: ' . $attributes['postTitleColor'] . '; | |
| 57 | + }'; | |
| 58 | + | |
| 59 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ | |
| 60 | + color:' . $attributes['linkColor'] . '; | |
| 61 | + }'; | |
| 62 | + | |
| 63 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ | |
| 64 | + color:' . $attributes['linkColor'] . '; | |
| 65 | + }'; | |
| 66 | + | |
| 67 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ | |
| 68 | + color:' . $attributes['generalColor'] . '; | |
| 69 | + }'; | |
| 70 | + | |
| 71 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ | |
| 72 | + color:' . $attributes['generalColor'] . '; | |
| 73 | + }'; | |
| 74 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count{ | |
| 75 | + color:' . $attributes['generalColor'] . '; | |
| 76 | + }'; | |
| 77 | + | |
| 78 | + $layoutstyle = explode('-', $attributes['express']); | |
| 79 | + | |
| 80 | + if ($layoutstyle[6] > 3) { | |
| 81 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img { | |
| 82 | + border-radius:' . $attributes['borderRadius'] . 'px' . '; | |
| 83 | + }'; | |
| 84 | + if ($attributes['enableBoxShadow']) { | |
| 85 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img { | |
| 86 | + box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 82 | 87 | }'; |
| 83 | - | |
| 84 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ | |
| 88 | + } | |
| 89 | + } else { | |
| 90 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 91 | + border-radius:' . $attributes['borderRadius'] . 'px' . '; | |
| 92 | + background-color:' . $attributes['backGroundColor'] . ' | |
| 93 | + }'; | |
| 94 | + | |
| 95 | + if ($attributes['enableBoxShadow']) { | |
| 96 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 97 | + box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 98 | + }'; | |
| 99 | + } | |
| 100 | + | |
| 101 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ | |
| 85 | 102 | padding-top:' . $attributes['contentPaddingTop'] . 'px; |
| 86 | 103 | padding-right:' . $attributes['contentPaddingRight'] . 'px; |
| 87 | 104 | padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; |
| 88 | 105 | padding-left:' . $attributes['contentPaddingLeft'] . 'px; |
| 89 | - }'; | |
| 90 | - | |
| 91 | - | |
| 92 | - | |
| 93 | - if ($attributes['categoryLayoutOption'] == 'solid') { | |
| 94 | - | |
| 95 | - | |
| 96 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ | |
| 97 | - color:' . $attributes['categoryTextColor'] . "!important" . '; | |
| 98 | - background-color:' . $attributes['categoryBackgroundColor'] . "!important" . '; | |
| 99 | - border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; | |
| 100 | - }'; | |
| 101 | - | |
| 102 | - } else if ($attributes['categoryLayoutOption'] == 'border') { | |
| 103 | - | |
| 104 | - | |
| 105 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ | |
| 106 | - color:' . $attributes['categoryTextColor'] . "!important" . '; | |
| 107 | - background-color:' . "transparent" . '; | |
| 108 | - border:' . "1px solid" . $attributes['categoryBorderColor'] . '; | |
| 109 | - border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; | |
| 110 | - border-width:' . $attributes['categoryBorderWidth'] . "px" . '; | |
| 111 | - }'; | |
| 112 | - | |
| 113 | - | |
| 114 | - | |
| 115 | - | |
| 116 | - } else { | |
| 117 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ | |
| 118 | - color:' . $attributes['categoryTextColor'] . "!important" . '; | |
| 119 | - }'; | |
| 120 | - } | |
| 121 | - | |
| 122 | - | |
| 123 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category{ | |
| 124 | - margin-top:' . $attributes['categoryMarginTop'] . 'px' . '; | |
| 125 | - margin-bottom:' . $attributes['categoryMarginBottom'] . 'px' . '; | |
| 126 | - margin-left:' . $attributes['categoryMarginLeft'] . 'px' . '; | |
| 127 | - margin-right:' . $attributes['categoryMarginRight'] . 'px' . '; | |
| 128 | - }'; | |
| 129 | - | |
| 130 | - | |
| 131 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-byline{ | |
| 132 | - | |
| 133 | - margin-top:' . $attributes['metaMarginTop'] . 'px' . '; | |
| 134 | - margin-bottom:' . $attributes['metaMarginBottom'] . 'px' . '; | |
| 135 | - margin-left:' . $attributes['metaMarginLeft'] . 'px' . '; | |
| 136 | - margin-right:' . $attributes['metaMarginRight'] . 'px' . '; | |
| 137 | - }'; | |
| 138 | - | |
| 139 | - | |
| 140 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link{ | |
| 141 | - margin-top:' . $attributes['moreLinkMarginTop'] . 'px' . '; | |
| 142 | - margin-bottom:' . $attributes['moreLinkMarginBottom'] . 'px' . '; | |
| 143 | - margin-left:' . $attributes['moreLinkMarginLeft'] . 'px' . '; | |
| 144 | - margin-right:' . $attributes['moreLinkMarginRight'] . 'px' . '; | |
| 145 | - }'; | |
| 106 | + }'; | |
| 107 | + } | |
| 146 | 108 | |
| 109 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title{ | |
| 110 | + margin-top:' . $attributes['titleMarginTop'] . 'px' . '; | |
| 111 | + margin-bottom:' . $attributes['titleMarginBottom'] . 'px' . '; | |
| 112 | + margin-left:' . $attributes['titleMarginLeft'] . 'px' . '; | |
| 113 | + margin-right:' . $attributes['titleMarginRight'] . 'px' . '; | |
| 114 | + }'; | |
| 147 | 115 | |
| 116 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ | |
| 117 | + margin-top:' . $attributes['exceprtMarginTop'] . 'px' . '; | |
| 118 | + margin-bottom:' . $attributes['exceprtMarginBottom'] . 'px' . '; | |
| 119 | + margin-left:' . $attributes['exceprtMarginLeft'] . 'px' . '; | |
| 120 | + margin-right:' . $attributes['exceprtMarginRight'] . 'px' . '; | |
| 121 | + }'; | |
| 148 | 122 | |
| 123 | + //Title Hover | |
| 124 | + if ($attributes['titleOnHover'] == 'lpc-title-hover') { | |
| 125 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-title-link:hover span{ | |
| 126 | + color: ' . $attributes['titleOnHoverColor'] . '; | |
| 127 | + }'; | |
| 128 | + } | |
| 149 | 129 | |
| 150 | - | |
| 151 | - | |
| 152 | - | |
| 153 | - | |
| 154 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 155 | - color: ' . $attributes['postTitleColor'] . '; | |
| 156 | - | |
| 157 | - }'; | |
| 158 | - | |
| 159 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ | |
| 160 | - color:' . $attributes['linkColor'] . '; | |
| 161 | - }'; | |
| 162 | - | |
| 163 | - | |
| 164 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ | |
| 165 | - color:' . $attributes['linkColor'] . '; | |
| 166 | - }'; | |
| 167 | - | |
| 168 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ | |
| 169 | - color:' . $attributes['generalColor'] . '; | |
| 170 | - }'; | |
| 171 | - | |
| 172 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content, '.' .' . $blockuniqueclass . ' .comment_count{ | |
| 173 | - color:' . $attributes['generalColor'] . '; | |
| 174 | - | |
| 175 | - }'; | |
| 130 | + if ($attributes['titleOnHover'] == 'lpc-title-border') { | |
| 131 | + $inline_css .= ' .' . $blockuniqueclass . ' .lpc-title-border .blockspare-posts-block-post-grid-title .blockspare-posts-block-title-link span:hover{ | |
| 132 | + box-shadow: inset 0 -2px 0 0 ' . $attributes['titleOnHoverColor'] . '; | |
| 133 | + }'; | |
| 134 | + } | |
| 176 | 135 | |
| 177 | 136 | |
| 178 | - $layoutstyle = explode('-',$attributes['express']); | |
| 137 | + //Font Settings | |
| 138 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 139 | + font-size: ' . $attributes['postTitleFontSize'] . $attributes['titleFontSizeType'] . '; | |
| 140 | + ' . bscheckFontfamily($attributes['titleFontFamily']) . '; | |
| 141 | + ' . bscheckFontfamilyWeight($attributes['titleFontWeight']) . '; | |
| 142 | + line-height: ' . $attributes['postTitleLineHeight'] . '; | |
| 143 | + }'; | |
| 179 | 144 | |
| 180 | - if($layoutstyle[6] >3){ | |
| 181 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img img{ | |
| 182 | - border-radius:' . $attributes['borderRadius'] . 'px'.'; | |
| 183 | - | |
| 184 | - }'; | |
| 185 | - if($attributes['enableBoxShadow']){ | |
| 186 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img img{ | |
| 187 | - box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 188 | - }'; | |
| 189 | - } | |
| 190 | - }else{ | |
| 191 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 192 | - border-radius:' . $attributes['borderRadius'] . 'px'.'; | |
| 193 | - background-color:'.$attributes['backGroundColor'].' | |
| 194 | - }'; | |
| 145 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ | |
| 146 | + font-size:' . $attributes['descriptionFontSize'] . $attributes['descriptionFontSizeType'] . '; | |
| 147 | + ' . bscheckFontfamily($attributes['descriptionFontFamily']) . '; | |
| 148 | + ' . bscheckFontfamilyWeight($attributes['descriptionFontWeight']) . '; | |
| 149 | + }'; | |
| 195 | 150 | |
| 196 | - if($attributes['enableBoxShadow']){ | |
| 197 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 198 | - box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 199 | - }'; | |
| 200 | - } | |
| 151 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span { | |
| 152 | + font-size:' . $attributes['postMetaFontSize'] . $attributes['postMetaFontSizeType'] . '; | |
| 153 | + ' . bscheckFontfamily($attributes['postMetaFontFamily']) . '; | |
| 154 | + ' . bscheckFontfamilyWeight($attributes['postMetaFontWeight']) . '; | |
| 155 | + }'; | |
| 201 | 156 | |
| 157 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date { | |
| 158 | + font-size:' . $attributes['postMetaFontSize'] . $attributes['postMetaFontSizeType'] . '; | |
| 159 | + ' . bscheckFontfamily($attributes['postMetaFontFamily']) . '; | |
| 160 | + ' . bscheckFontfamilyWeight($attributes['postMetaFontWeight']) . '; | |
| 161 | + }'; | |
| 202 | 162 | |
| 203 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ | |
| 204 | - padding-top:' . $attributes['contentPaddingTop'] . 'px; | |
| 205 | - padding-right:' . $attributes['contentPaddingRight'] . 'px; | |
| 206 | - padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; | |
| 207 | - padding-left:' . $attributes['contentPaddingLeft'] . 'px; | |
| 208 | - }'; | |
| 209 | - | |
| 210 | - } | |
| 211 | - | |
| 212 | - | |
| 213 | - | |
| 214 | - | |
| 215 | - | |
| 216 | - | |
| 217 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title{ | |
| 218 | - margin-top:' . $attributes['titleMarginTop'] . 'px' . '; | |
| 219 | - margin-bottom:' . $attributes['titleMarginBottom'] . 'px' . '; | |
| 220 | - margin-left:' . $attributes['titleMarginLeft'] . 'px' . '; | |
| 221 | - margin-right:' . $attributes['titleMarginRight'] . 'px' . '; | |
| 163 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count { | |
| 164 | + font-size:' . $attributes['postMetaFontSize'] . $attributes['postMetaFontSizeType'] . '; | |
| 165 | + ' . bscheckFontfamily($attributes['postMetaFontFamily']) . '; | |
| 166 | + ' . bscheckFontfamilyWeight($attributes['postMetaFontWeight']) . '; | |
| 167 | + }'; | |
| 168 | + | |
| 169 | + $inline_css .= '@media (max-width: 1025px) { '; | |
| 170 | + | |
| 171 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 172 | + font-size: ' . $attributes['titleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; | |
| 173 | + }'; | |
| 174 | + | |
| 175 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ | |
| 176 | + font-size:' . $attributes['descriptionFontSizeTablet'] . $attributes['descriptionFontSizeType'] . ' | |
| 177 | + }'; | |
| 178 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span { | |
| 179 | + font-size:' . $attributes['postMetaFontSizeTablet'] . $attributes['postMetaFontSizeType'] . ' | |
| 180 | + }'; | |
| 181 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date { | |
| 182 | + font-size:' . $attributes['postMetaFontSizeTablet'] . $attributes['postMetaFontSizeType'] . ' | |
| 183 | + }'; | |
| 184 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count { | |
| 185 | + font-size:' . $attributes['postMetaFontSizeTablet'] . $attributes['postMetaFontSizeType'] . ' | |
| 186 | + }'; | |
| 187 | + | |
| 188 | + $inline_css .= '}'; | |
| 189 | + | |
| 190 | + $inline_css .= '@media (max-width: 767px) { '; | |
| 191 | + | |
| 192 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 193 | + font-size: ' . $attributes['titleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; | |
| 194 | + }'; | |
| 195 | + | |
| 196 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ | |
| 197 | + font-size:' . $attributes['descriptionFontSizeMobile'] . $attributes['descriptionFontSizeType'] . ' | |
| 198 | + }'; | |
| 199 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span { | |
| 200 | + font-size:' . $attributes['postMetaFontSizeMobile'] . $attributes['postMetaFontSizeType'] . ' | |
| 201 | + }'; | |
| 202 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date { | |
| 203 | + font-size:' . $attributes['postMetaFontSizeMobile'] . $attributes['postMetaFontSizeType'] . ' | |
| 204 | + }'; | |
| 205 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count { | |
| 206 | + font-size:' . $attributes['postMetaFontSizeMobile'] . $attributes['postMetaFontSizeType'] . ' | |
| 207 | + }'; | |
| 208 | + | |
| 209 | + $inline_css .= '}'; | |
| 210 | + | |
| 211 | + if ($attributes['express'] != 'blockspare-posts-block-express-grid-layout-3' && $attributes['express'] != 'blockspare-posts-block-express-grid-layout-6') { | |
| 212 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 213 | + font-size: ' . $attributes['spostTitleFontSize'] . $attributes['spostTitleFontSizeType'] . '; | |
| 214 | + ' . bscheckFontfamily($attributes['spostTitleFontFamily']) . '; | |
| 215 | + ' . bscheckFontfamilyWeight($attributes['spostTitleFontWeight']) . '; | |
| 222 | 216 | }'; |
| 223 | - | |
| 224 | - | |
| 225 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ | |
| 226 | - margin-top:' . $attributes['exceprtMarginTop'] . 'px' . '; | |
| 227 | - margin-bottom:' . $attributes['exceprtMarginBottom'] . 'px' . '; | |
| 228 | - margin-left:' . $attributes['exceprtMarginLeft'] . 'px' . '; | |
| 229 | - margin-right:' . $attributes['exceprtMarginRight'] . 'px' . '; | |
| 230 | - }'; | |
| 231 | - | |
| 232 | - | |
| 233 | - | |
| 234 | - //Title Hover | |
| 235 | - if($attributes['titleOnHover']=='lpc-title-hover') { | |
| 236 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-title-link:hover span{ | |
| 237 | - color: ' . $attributes['titleOnHoverColor'] . '; | |
| 238 | - | |
| 239 | - }'; | |
| 240 | - } | |
| 241 | - | |
| 242 | - if($attributes['titleOnHover']=='lpc-title-border') { | |
| 243 | - $block_content .= ' .' . $blockuniqueclass . ' .lpc-title-border .blockspare-posts-block-post-grid-title .blockspare-posts-block-title-link span:hover{ | |
| 244 | - box-shadow: inset 0 -2px 0 0 ' . $attributes['titleOnHoverColor'] . '; | |
| 245 | - | |
| 246 | - }'; | |
| 247 | - } | |
| 248 | - | |
| 249 | - | |
| 250 | - //Font Settings | |
| 251 | - | |
| 252 | - | |
| 253 | - if($attributes['express']!='blockspare-posts-block-express-grid-layout-3'&& $attributes['express']!='blockspare-posts-block-express-grid-layout-6' ){ | |
| 254 | - | |
| 255 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 256 | - | |
| 257 | - font-size: ' . $attributes['spostTitleFontSize'] . $attributes['titleFontSizeType'] . '; | |
| 258 | - '.bscheckFontfamily($attributes['spostTitleFontFamily']).'; | |
| 259 | - font-weight: ' . $attributes['spostTitleFontWeight'] . '; | |
| 260 | - }'; | |
| 261 | - | |
| 262 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 263 | - | |
| 264 | - font-size: ' . $attributes['postTitleFontSize'] . $attributes['titleFontSizeType'] . '; | |
| 265 | - '.bscheckFontfamily($attributes['titleFontFamily']).'; | |
| 266 | - font-weight: ' . $attributes['titleFontWeight'] . '; | |
| 217 | + | |
| 218 | + $inline_css .= '@media (max-width: 1025px) { '; | |
| 219 | + | |
| 220 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 221 | + font-size: ' . $attributes['spostTitleFontSizeTablet'] . $attributes['spostTitleFontSizeType'] . '; | |
| 222 | + }'; | |
| 223 | + | |
| 224 | + $inline_css .= '}'; | |
| 225 | + $inline_css .= '@media (max-width: 767px) { '; | |
| 226 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 227 | + font-size: ' . $attributes['spostTitleFontSizeMobile'] . $attributes['spostTitleFontSizeType'] . '; | |
| 228 | + }'; | |
| 229 | + | |
| 230 | + $inline_css .= '}'; | |
| 231 | + } else { | |
| 232 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 233 | + font-size: ' . $attributes['spostTitleFontSize'] . $attributes['spostTitleFontSizeType'] . '; | |
| 234 | + ' . bscheckFontfamily($attributes['spostTitleFontFamily']) . '; | |
| 235 | + ' . bscheckFontfamilyWeight($attributes['spostTitleFontWeight']) . '; | |
| 236 | + }'; | |
| 237 | + | |
| 238 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(2) .blockspare-posts-block-post-grid-title a span{ | |
| 239 | + font-size: ' . $attributes['spostTitleFontSize'] . $attributes['spostTitleFontSizeType'] . '; | |
| 240 | + ' . bscheckFontfamily($attributes['spostTitleFontFamily']) . '; | |
| 241 | + ' . bscheckFontfamilyWeight($attributes['spostTitleFontWeight']) . '; | |
| 242 | + }'; | |
| 243 | + | |
| 244 | + $inline_css .= '@media (max-width: 1025px) { '; | |
| 245 | + | |
| 246 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 247 | + font-size: ' . $attributes['spostTitleFontSizeTablet'] . $attributes['spostTitleFontSizeType'] . '; | |
| 248 | + }'; | |
| 249 | + | |
| 250 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(2) .blockspare-posts-block-post-grid-title a span{ | |
| 251 | + font-size: ' . $attributes['spostTitleFontSizeTablet'] . $attributes['spostTitleFontSizeType'] . '; | |
| 252 | + }'; | |
| 253 | + | |
| 254 | + $inline_css .= '}'; | |
| 255 | + | |
| 256 | + $inline_css .= '@media (max-width: 767px) { '; | |
| 257 | + | |
| 258 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 259 | + font-size: ' . $attributes['spostTitleFontSizeMobile'] . $attributes['spostTitleFontSizeType'] . '; | |
| 260 | + }'; | |
| 261 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(2) .blockspare-posts-block-post-grid-title a span{ | |
| 262 | + font-size: ' . $attributes['spostTitleFontSizeMobile'] . $attributes['spostTitleFontSizeType'] . '; | |
| 263 | + }'; | |
| 264 | + | |
| 265 | + $inline_css .= '}'; | |
| 266 | + } | |
| 267 | + | |
| 268 | + //Pagination | |
| 269 | + if ($attributes['enablePagination']) { | |
| 270 | + if ($attributes['loadMoreStyle'] == 'bs-loadmore-solid') { | |
| 271 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn{ | |
| 272 | + color:' . $attributes['loadMoreSolidTextColor'] . '; | |
| 273 | + background-color:' . $attributes['loadMoreTextBgColor'] . '; | |
| 267 | 274 | }'; |
| 268 | - | |
| 269 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ | |
| 270 | - font-size:' . $attributes['descriptionFontSize'] . $attributes['descriptionFontSizeType'] . '; | |
| 271 | - '.bscheckFontfamily($attributes['descriptionFontFamily']).'; | |
| 272 | - font-weight: ' . $attributes['descriptionFontWeight'] . '; | |
| 273 | - }'; | |
| 274 | - | |
| 275 | - | |
| 276 | - | |
| 277 | - $block_content .= '@media (max-width: 1025px) { '; | |
| 278 | - | |
| 279 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 280 | - font-size: ' . $attributes['spostTitleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; | |
| 275 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn:hover{ | |
| 276 | + color:' . $attributes['loadMoreSolidTextHoverColor'] . '; | |
| 277 | + background-color:' . $attributes['loadMoreTextBgHoverColor'] . '; | |
| 281 | 278 | }'; |
| 282 | - | |
| 283 | - | |
| 284 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 285 | - font-size: ' . $attributes['titleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; | |
| 279 | + } else { | |
| 280 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn{ | |
| 281 | + color:' . $attributes['loadMoreTextColor'] . '; | |
| 286 | 282 | }'; |
| 287 | - | |
| 288 | - $block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ | |
| 289 | - font-size:' . $attributes['descriptionFontSizeTablet'].$attributes['descriptionFontSizeType'].' | |
| 290 | - }'; | |
| 291 | - | |
| 292 | - | |
| 293 | - $block_content .= '}'; | |
| 294 | - $block_content .= '@media (max-width: 768px) { '; | |
| 295 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span{ | |
| 296 | - font-size: ' . $attributes['spostTitleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; | |
| 283 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn:hover{ | |
| 284 | + color:' . $attributes['loadMoreTextHoverColor'] . '; | |
| 297 | 285 | }'; |
| 298 | - | |
| 299 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 300 | - font-size: ' . $attributes['titleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; | |
| 301 | - }'; | |
| 302 | - | |
| 303 | - $block_content .= '}'; | |
| 304 | - }else{ | |
| 305 | - | |
| 306 | - | |
| 307 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span,'.' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(2) .blockspare-posts-block-post-grid-title a span{ | |
| 308 | - | |
| 309 | - font-size: ' . $attributes['spostTitleFontSize'] . $attributes['titleFontSizeType'] . '; | |
| 310 | - | |
| 311 | - '.bscheckFontfamily($attributes['spostTitleFontFamily']).'; | |
| 312 | - font-weight: ' . $attributes['spostTitleFontWeight'] . '; | |
| 313 | - }'; | |
| 314 | - | |
| 315 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 316 | - | |
| 317 | - font-size: ' . $attributes['postTitleFontSize'] . $attributes['titleFontSizeType'] . '; | |
| 318 | - '.bscheckFontfamily($attributes['titleFontFamily']).'; | |
| 319 | - font-weight: ' . $attributes['titleFontWeight'] . '; | |
| 320 | - }'; | |
| 321 | - | |
| 322 | - | |
| 323 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ | |
| 324 | - font-size:' . $attributes['descriptionFontSize'] . $attributes['descriptionFontSizeType'] . '; | |
| 325 | - '.bscheckFontfamily($attributes['descriptionFontFamily']).'; | |
| 326 | - font-weight: ' . $attributes['descriptionFontWeight'] . '; | |
| 327 | - }'; | |
| 328 | - | |
| 329 | - | |
| 330 | - | |
| 331 | - $block_content .= '@media (max-width: 1025px) { '; | |
| 332 | - | |
| 333 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span,'.' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(2) .blockspare-posts-block-post-grid-title a span{ | |
| 334 | - font-size: ' . $attributes['spostTitleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; | |
| 335 | - }'; | |
| 336 | - | |
| 337 | - $block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ | |
| 338 | - font-size:' . $attributes['descriptionFontSizeTablet'].$attributes['descriptionFontSizeType'].' | |
| 339 | - }'; | |
| 340 | - | |
| 341 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 342 | - font-size: ' . $attributes['titleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; | |
| 343 | - }'; | |
| 344 | - | |
| 345 | - $block_content .= '}'; | |
| 346 | - $block_content .= '@media (max-width: 768px) { '; | |
| 347 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(1) .blockspare-posts-block-post-grid-title a span,'.' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single:nth-child(2) .blockspare-posts-block-post-grid-title a span{ | |
| 348 | - font-size: ' . $attributes['spostTitleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; | |
| 349 | - }'; | |
| 350 | - | |
| 351 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 352 | - font-size: ' . $attributes['titleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; | |
| 353 | - }'; | |
| 354 | - | |
| 355 | - $block_content .= '}'; | |
| 356 | - | |
| 357 | - } | |
| 286 | + } | |
| 358 | 287 | |
| 359 | - //Pagination | |
| 360 | - if($attributes['enablePagination']){ | |
| 361 | - $block_content .=' .' . $blockuniqueclass . ' + .bs_blockspare_loadmore a.blockspare-readmore .load-btn{ | |
| 362 | - color:'.$attributes['loadMoreTextColor'].'; | |
| 363 | - background-color:'.$attributes['loadMoreTextBgColor'].'; | |
| 364 | - '.bscheckFontfamily($attributes['titleFontFamily']).'; | |
| 288 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore{ | |
| 289 | + text-align:' . $attributes['loadMoreAlignment'] . '; | |
| 365 | 290 | }'; |
| 366 | - $block_content .=' .' . $blockuniqueclass . ' + .bs_blockspare_loadmore a.blockspare-readmore .ajax-loader-enabled{ | |
| 367 | - border-top-color:'.$attributes['loadMoreColor'].'; | |
| 291 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .ajax-loader-enabled{ | |
| 292 | + border-top-color:' . $attributes['loadMoreColor'] . '; | |
| 368 | 293 | }'; |
| 369 | - $block_content .= '}'; | |
| 370 | - | |
| 294 | + $inline_css .= '}'; | |
| 295 | + } | |
| 296 | + | |
| 297 | + | |
| 298 | + // $block_content .= blockspare_minify_css($inline_css); | |
| 299 | + | |
| 300 | + // $block_content .= '</style>'; | |
| 301 | + // return $block_content; | |
| 302 | + if (!empty($inline_css)) { | |
| 303 | + wp_register_style('bs-express-grid', false); | |
| 304 | + wp_enqueue_style('bs-express-grid'); | |
| 305 | + wp_add_inline_style('bs-express-grid', blockspare_minify_css($inline_css)); | |
| 306 | + } | |
| 307 | + } | |
| 308 | +} | |
| 309 | + | |
| 310 | + | |
| 311 | +function blockspare_epxpress_query_loop_and_wrapper($attributes, $blockclass = '', $design = '', $blockName = '', $layoutClass = false) | |
| 312 | +{ | |
| 313 | + $unq_class = mt_rand(100000, 999999); | |
| 314 | + $blockuniqueclass = ''; | |
| 315 | + | |
| 316 | + if (!empty($attributes['uniqueClass'])) { | |
| 317 | + $blockuniqueclass = $attributes['uniqueClass']; | |
| 318 | + } else { | |
| 319 | + $blockuniqueclass = 'blockspare-posts-block-list-' . $unq_class; | |
| 320 | + } | |
| 321 | + | |
| 322 | + $grid_query = blockspare_post_query($attributes); | |
| 323 | + | |
| 324 | + $count = 0; | |
| 325 | + if ($grid_query->have_posts()) { | |
| 326 | + $alignclass = blockspare_checkalignment($attributes['align']); | |
| 327 | + | |
| 328 | + | |
| 329 | + /* Build the block classes */ | |
| 330 | + $class = "wp-block-blockspare-posts-block-blockspare-posts-block-latest-posts align" . $alignclass . " " . $attributes['blockHoverEffect']; | |
| 331 | + | |
| 332 | + if (isset($attributes['className'])) { | |
| 333 | + $class .= ' ' . $attributes['className']; | |
| 334 | + } | |
| 335 | + | |
| 336 | + if ($attributes['animation']) { | |
| 337 | + $class .= ' blockspare-block-animation'; | |
| 338 | + } | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + $list_layout_class = $design; | |
| 343 | + $listgridClass = $blockclass . " "; | |
| 344 | + | |
| 345 | + | |
| 346 | + /* Layout orientation class */ | |
| 347 | + $grid_class = 'blockspare-posts-block-latest-post-wrap ' . $listgridClass . ' ' . $list_layout_class; | |
| 348 | + $class .= ' ' . $blockuniqueclass; | |
| 349 | + $category_class = 'blockspare-posts-block-post-category'; | |
| 350 | + | |
| 351 | + if ($attributes['categoryLayoutOption'] == 'none') { | |
| 352 | + $category_class .= ' has-no-category-style'; | |
| 353 | + } ?> | |
| 354 | + | |
| 355 | + <section class="blockspare-posts-block-post-wrap"> | |
| 356 | + <div class="<?php echo esc_attr($grid_class); ?>"> | |
| 357 | + <?php while ($grid_query->have_posts()) { | |
| 358 | + $grid_query->the_post(); | |
| 359 | + | |
| 360 | + /* Setup the post ID */ | |
| 361 | + $post_id = get_the_ID(); | |
| 362 | + | |
| 363 | + /* Setup the featured image ID */ | |
| 364 | + $post_thumb_id = get_post_thumbnail_id($post_id); | |
| 365 | + | |
| 366 | + $has_img_class = ''; | |
| 367 | + | |
| 368 | + if (!$post_thumb_id) { | |
| 369 | + $has_img_class = "post-has-no-image"; | |
| 370 | + } | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + if ($attributes['enableEqualHeight']) { | |
| 376 | + $has_img_class .= ' bs-has-equal-height'; | |
| 377 | + } | |
| 378 | + $contentOrderClass = ''; | |
| 379 | + if ($attributes['contentOrder'] == 'content-order-1') { | |
| 380 | + $contentOrderClass .= 'contentorderone'; | |
| 381 | + } | |
| 382 | + if ($attributes['contentOrder'] == 'content-order-2') { | |
| 383 | + $contentOrderClass .= 'contentordertwo'; | |
| 384 | + } | |
| 385 | + | |
| 386 | + /* Setup the post classes */ | |
| 387 | + $post_classes = 'blockspare-posts-block-post-single blockspare-hover-item ' . $contentOrderClass; | |
| 388 | + | |
| 389 | + if ($layoutClass) { | |
| 390 | + $post_classes .= ' has-background'; | |
| 391 | + } else { | |
| 392 | + $post_classes .= ' blockspare-hover-child'; | |
| 393 | + } | |
| 394 | + | |
| 395 | + $className = ''; | |
| 396 | + | |
| 397 | + if (isset($attributes['full'])) { | |
| 398 | + if ($attributes['full'] == 'blockspare-posts-block-full-layout-6') { | |
| 399 | + $post_classes .= ' blockspare-hover-child'; | |
| 400 | + $className .= 'hover-child'; | |
| 371 | 401 | } |
| 372 | - | |
| 402 | + } | |
| 373 | 403 | |
| 374 | - | |
| 375 | - $block_content .= '</style>'; | |
| 376 | - return $block_content; | |
| 377 | - } | |
| 378 | -} | |
| 404 | + | |
| 405 | + /* Add sticky class */ | |
| 406 | + if (is_sticky($post_id)) { | |
| 407 | + $post_classes .= ' sticky'; | |
| 408 | + } else { | |
| 409 | + $post_classes .= null; | |
| 410 | + } | |
| 411 | + $post_classes .= ' has-background'; | |
| 412 | + ?> | |
| 413 | + <div id="<?php echo esc_attr($post_id); ?>" class="<?php echo esc_attr($post_classes) . ' ' . $has_img_class; ?>"> | |
| 414 | + <?php blockspare_express_post_image($attributes, $post_id, $category_class, $blockName, $className, $count); ?> | |
| 415 | + <?php blockspare_express_post_content($attributes, $post_id, $category_class, $blockName, $className, $count); ?> | |
| 416 | + </div> | |
| 417 | + | |
| 418 | + <?php $count++; | |
| 419 | + } ?> | |
| 420 | + | |
| 421 | + </div> | |
| 422 | + <?php | |
| 423 | + if ($attributes['enablePagination'] == 'true' && $grid_query->max_num_pages > 1) { | |
| 424 | + $loadmore_class = ''; | |
| 425 | + if ($attributes['loadMoreStyle']) { | |
| 426 | + $loadmore_class = $attributes['loadMoreStyle']; | |
| 427 | + } | |
| 428 | + if ($attributes['loadMoreAlignment']) { | |
| 429 | + $loadmore_class .= ' bs_blockspare_loadmore_' . $attributes['loadMoreAlignment']; | |
| 430 | + } | |
| 431 | + ?> | |
| 432 | + <div class="bs_blockspare_loadmore blockspare-readmore-wrapper <?php echo esc_attr($loadmore_class); ?>" data-layout="<?php echo $layoutClass; ?>" block-name="express" data-page='2' blockspare-att=<?php echo "'" . wp_kses_post(wp_json_encode($attributes)) . "'"; ?> max-paged="<?php echo $grid_query->max_num_pages; ?>"> | |
| 433 | + <a href="#" class="blockspare-readmore"> | |
| 434 | + <div class="load-btn "><?php echo ($attributes['loadMoreText']); ?><span class="ajax-loader"></span></div> | |
| 435 | + </a> | |
| 436 | + </div><?php | |
| 437 | + } | |
| 438 | + ?> | |
| 439 | + </section> | |
| 440 | + | |
| 441 | + <?php | |
| 442 | + } | |
| 443 | + | |
| 444 | + wp_reset_postdata(); | |
| 445 | +} | |
| 446 | + | |
| 447 | +function blockspare_express_post_image($attributes, $post_id, $cat_class, $blockName = '', $className = '', $count = '') | |
| 448 | +{ | |
| 449 | + | |
| 450 | + | |
| 451 | + $spotlightItems = 0; | |
| 452 | + if ($attributes['express'] == 'blockspare-posts-block-express-grid-layout-3' || $attributes['express'] == 'blockspare-posts-block-express-grid-layout-6') { | |
| 453 | + $spotlightItems = 1; | |
| 454 | + } | |
| 455 | + /* Setup the featured image ID */ | |
| 456 | + $post_thumb_id = get_post_thumbnail_id($post_id); | |
| 457 | + | |
| 458 | + | |
| 459 | + if (!empty($attributes['imageSize'])) { | |
| 460 | + $post_thumb_size = $attributes['imageSize']; | |
| 461 | + } | |
| 462 | + | |
| 463 | + $content_order = false; | |
| 464 | + if ($attributes['contentOrder'] == 'content-order-1' || $attributes['contentOrder'] == 'content-order-2') { | |
| 465 | + $content_order = true; | |
| 466 | + } | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + if (isset($attributes['enableFeatureImage']) && $attributes['enableFeatureImage'] == 'true') { | |
| 472 | + ?> | |
| 473 | + <figure class="blockspare-posts-block-post-img hover-child"> | |
| 474 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" aria-label="<?php echo esc_attr(get_the_title($post_id)); ?>"> | |
| 475 | + <?php | |
| 476 | + if (has_post_thumbnail($post_id)) { | |
| 477 | + if ($count <= $spotlightItems) { | |
| 478 | + echo wp_kses_post(wp_get_attachment_image($post_thumb_id, $attributes['spotslightImageSize'])); | |
| 479 | + } | |
| 480 | + if ($count > $spotlightItems) { | |
| 481 | + echo wp_kses_post(wp_get_attachment_image($post_thumb_id, $post_thumb_size)); | |
| 482 | + } | |
| 483 | + } else { ?> | |
| 484 | + <div class="bs-no-thumbnail-img"> </div> | |
| 485 | + <?php } ?> | |
| 486 | + </a> | |
| 487 | + <?php if ($attributes['displaySpotlightPostCategory'] == 'true' && $content_order == true && $count <= $spotlightItems) { ?> | |
| 488 | + <!-- Spotlight Category --> | |
| 489 | + <div class="<?php echo esc_attr($cat_class); ?>"> | |
| 490 | + <?php blockspare_get_cat_tax_tags($attributes['taxType'], $post_id, $attributes['postType']); ?> | |
| 491 | + </div> | |
| 492 | + <!-- Spotlight Category --> | |
| 493 | + <?php } ?> | |
| 494 | + <?php if ($attributes['displayPostCategory'] == 'true' && $content_order == true && $count > $spotlightItems) { ?> | |
| 495 | + <!-- Category --> | |
| 496 | + <div class="<?php echo esc_attr($cat_class); ?>"> | |
| 497 | + <?php blockspare_get_cat_tax_tags($attributes['taxType'], $post_id, $attributes['postType']); ?> | |
| 498 | + </div> | |
| 499 | + <!-- Category --> | |
| 500 | + <?php } ?> | |
| 501 | + </figure> | |
| 502 | + <?php | |
| 503 | + } | |
| 504 | +} | |
| 505 | + | |
| 506 | +function blockspare_express_post_content($attributes, $post_id, $cat_class, $blockName = '', $className = '', $count = '') | |
| 507 | +{ | |
| 508 | + $spotlightItems = 0; | |
| 509 | + if ($attributes['express'] == 'blockspare-posts-block-express-grid-layout-3' || $attributes['express'] == 'blockspare-posts-block-express-grid-layout-6') { | |
| 510 | + $spotlightItems = 1; | |
| 511 | + } | |
| 512 | + $content_order = false; | |
| 513 | + if ($attributes['contentOrder'] == 'content-order-1' || $attributes['contentOrder'] == 'content-order-2') { | |
| 514 | + $content_order = true; | |
| 515 | + } | |
| 516 | + if ($blockName == 'full') { | |
| 517 | + $content_order = false; | |
| 518 | + } | |
| 519 | + ?> | |
| 520 | + <div class="blockspare-posts-block-post-content <?php echo esc_attr($className); ?> <?php echo esc_attr($attributes['contentOrder']); ?> <?php echo esc_attr($attributes['titleOnHover']) ?>"> | |
| 521 | + <div class="blockspare-posts-block-bg-overlay"></div> | |
| 522 | + <!-- blockspare-posts-block-post-grid-header --> | |
| 523 | + <header class="blockspare-posts-block-post-grid-header"> | |
| 524 | + <!--display category when feature image is disable --> | |
| 525 | + <?php if ($attributes['displayPostCategory'] == 'true' && $attributes['enableFeatureImage'] != 'true') { ?> | |
| 526 | + <!-- Category --> | |
| 527 | + <div class="<?php echo esc_attr($cat_class); ?>"> | |
| 528 | + <?php blockspare_get_cat_tax_tags($attributes['taxType'], $post_id, $attributes['postType']); ?> | |
| 529 | + </div> | |
| 530 | + <!-- Category --> | |
| 531 | + <?php } ?> | |
| 532 | + <!--display category when feature image is enable--> | |
| 533 | + <?php if ($attributes['displayPostCategory'] == 'true' && $attributes['enableFeatureImage'] == 'true' && $content_order == false) { ?> | |
| 534 | + <!-- Category --> | |
| 535 | + <div class="<?php echo esc_attr($cat_class); ?>"> | |
| 536 | + <?php blockspare_get_cat_tax_tags($attributes['taxType'], $post_id, $attributes['postType']); ?> | |
| 537 | + </div> | |
| 538 | + <!-- Category --> | |
| 539 | + <?php } ?> | |
| 540 | + <!-- blockspare-posts-block-post-grid-title --> | |
| 541 | + | |
| 542 | + <?php if ($attributes['displaySpotlightPostTitle'] == 'true' && $count <= $spotlightItems) { ?> | |
| 543 | + <h2 class="blockspare-posts-block-post-grid-title"> | |
| 544 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" class="blockspare-posts-block-title-link" | |
| 545 | + rel="bookmark"> | |
| 546 | + <span><?php echo get_the_title(); ?></span> | |
| 547 | + </a> | |
| 548 | + </h2> | |
| 549 | + <?php } ?> | |
| 550 | + <?php if ($attributes['displayPostTitle'] == 'true' && $count > $spotlightItems) { ?> | |
| 551 | + <h2 class="blockspare-posts-block-post-grid-title"> | |
| 552 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" class="blockspare-posts-block-title-link" | |
| 553 | + rel="bookmark"> | |
| 554 | + <span><?php echo get_the_title(); ?></span> | |
| 555 | + </a> | |
| 556 | + </h2> | |
| 557 | + | |
| 558 | + <?php } ?> | |
| 559 | + | |
| 560 | + <!-- blockspare-posts-block-post-grid-title --> | |
| 561 | + | |
| 562 | + <!-- blockspare-posts-block-post-grid-byline --> | |
| 563 | + <div class="blockspare-posts-block-post-grid-byline"> | |
| 564 | + <!-- blockspare-posts-block-post-grid-author --> | |
| 565 | + <?php if (isset($attributes['displaySpotlightPostAuthor']) && $attributes['displaySpotlightPostAuthor'] == 'true' && $count <= $spotlightItems) { ?> | |
| 566 | + <div class="blockspare-posts-block-post-grid-author"> | |
| 567 | + | |
| 568 | + <?php | |
| 569 | + $author_id = get_post_field('post_author', $post_id); | |
| 570 | + $blockspare_get_multiauthor = new BlocksapreMultiAuthorForFrontend(); | |
| 571 | + $blockspare_get_multiauthor->blockspare_front_by_author($post_id, $attributes['authorIcon'], $author_id); | |
| 572 | + ?> | |
| 573 | + </div> | |
| 574 | + <?php } ?> | |
| 575 | + <!-- spotlight blockspare-posts-block-post-grid-author --> | |
| 576 | + <!-- blockspare-posts-block-post-grid-author --> | |
| 577 | + <?php if (isset($attributes['displayPostAuthor']) && $attributes['displayPostAuthor'] == 'true' && $count > $spotlightItems) { ?> | |
| 578 | + <div class="blockspare-posts-block-post-grid-author"> | |
| 579 | + | |
| 580 | + <?php | |
| 581 | + $author_id = get_post_field('post_author', $post_id); | |
| 582 | + $blockspare_get_multiauthor = new BlocksapreMultiAuthorForFrontend(); | |
| 583 | + $blockspare_get_multiauthor->blockspare_front_by_author($post_id, $attributes['authorIcon'], $author_id); | |
| 584 | + ?> | |
| 585 | + </div> | |
| 586 | + <?php } ?> | |
| 587 | + <!-- blockspare-posts-block-post-grid-author --> | |
| 588 | + | |
| 589 | + <!-- Spotlight blockspare-posts-block-post-grid-date --> | |
| 590 | + <?php if (isset($attributes['displaySpotlightPostDate']) && $attributes['displaySpotlightPostDate'] == 'true' && $count <= $spotlightItems) { ?> | |
| 591 | + <time datetime="<?php echo esc_attr(get_the_date('c', $post_id)); ?>" class="blockspare-posts-block-post-grid-date" itemprop="datePublished"><i class="<?php echo esc_attr($attributes['dateIcon']); ?>" aria-hidden="true"></i><?php echo esc_html(get_the_date('', $post_id)); ?></time> | |
| 592 | + <?php } ?> | |
| 593 | + <!-- Spotlight blockspare-posts-block-post-grid-date --> | |
| 594 | + <!-- blockspare-posts-block-post-grid-date --> | |
| 595 | + <?php if (isset($attributes['displayPostDate']) && $attributes['displayPostDate'] == 'true' && $count > $spotlightItems) { ?> | |
| 596 | + <time datetime="<?php echo esc_attr(get_the_date('c', $post_id)); ?>" class="blockspare-posts-block-post-grid-date" itemprop="datePublished"><i class="<?php echo esc_attr($attributes['dateIcon']); ?>" aria-hidden="true"></i><?php echo esc_html(get_the_date('', $post_id)); ?></time> | |
| 597 | + <?php } ?> | |
| 598 | + <!-- blockspare-posts-block-post-grid-date --> | |
| 599 | + | |
| 600 | + <!-- Spotlight comment_count --> | |
| 601 | + <?php if ($attributes['enableSpotlightComment'] == 'true' && $count <= $spotlightItems) { ?> | |
| 602 | + <span class="comment_count"><i class='<?php echo esc_attr($attributes['commentIcon']); ?>' aria-hidden="true"></i><?php echo esc_html(get_comments_number($post_id)); ?></span> | |
| 603 | + <?php } ?> | |
| 604 | + <!-- Spotlight --> | |
| 605 | + <?php if ($attributes['enableComment'] == 'true' && $count > $spotlightItems) { ?> | |
| 606 | + <span class="comment_count"><i class='<?php echo esc_attr($attributes['commentIcon']); ?>' aria-hidden="true"></i><?php echo esc_html(get_comments_number($post_id)); ?></span> | |
| 607 | + <?php } ?> | |
| 608 | + <!-- comment_count --> | |
| 609 | + </div> | |
| 610 | + <!-- blockspare-posts-block-post-grid-byline --> | |
| 611 | + </header> | |
| 612 | + <!-- blockspare-posts-block-post-grid-header --> | |
| 613 | + | |
| 614 | + | |
| 615 | + <?php | |
| 616 | + | |
| 617 | + if ($attributes['displaySpotlightPostExcerpt'] == 'true' && $count <= $spotlightItems) { | |
| 618 | + $excerpts = blockspare_excerpt($post_id, $attributes['excerptSpotlightLength']); | |
| 619 | + $new_excerpt = apply_filters('the_excerpt', $excerpts); ?> | |
| 620 | + <!-- Spotlight blockspare-posts-block-post-grid-excerpt --> | |
| 621 | + <?php if ($attributes['displaySpotlightPostExcerpt'] && $new_excerpt != null) { ?> | |
| 622 | + <div class="blockspare-posts-block-post-grid-excerpt"> | |
| 623 | + <!-- blockspare-posts-block-post-grid-excerpt-content --> | |
| 624 | + <?php if (isset($attributes['displaySpotlightPostExcerpt']) && $attributes['displaySpotlightPostExcerpt'] == 'true') { ?> | |
| 625 | + <div class="blockspare-posts-block-post-grid-excerpt-content"> | |
| 626 | + <?php echo wp_kses_post($excerpts); ?> | |
| 627 | + </div> | |
| 628 | + <?php } ?> | |
| 629 | + <!-- blockspare-posts-block-post-grid-excerpt-content --> | |
| 630 | + <!-- blockspare-posts-block-post-grid-more-link --> | |
| 631 | + <?php if (isset($attributes['displaySpotPostLink']) && $attributes['displaySpotPostLink'] == 'true') { ?> | |
| 632 | + <p> | |
| 633 | + | |
| 634 | + | |
| 635 | + <a | |
| 636 | + class="blockspare-posts-block-post-grid-more-link blockspare-posts-block-text-link" | |
| 637 | + href="<?php echo esc_url(get_permalink($post_id)); ?>" | |
| 638 | + aria-label="<?php echo sprintf(esc_attr__('Read more about %s', 'blockspare'), esc_html(get_the_title($post_id))); ?>"> | |
| 639 | + <span aria-hidden="true"><?php echo esc_html($attributes['readMoreText']); ?></span> | |
| 640 | + </a> | |
| 641 | + | |
| 642 | + </p> | |
| 643 | + <?php } ?> | |
| 644 | + <!-- blockspare-posts-block-post-grid-more-link --> | |
| 645 | + </div> | |
| 646 | + <?php } | |
| 647 | + } ?> | |
| 648 | + <!-- Spotlight blockspare-posts-block-post-grid-excerpt --> | |
| 649 | + <?php | |
| 650 | + if ($attributes['displayPostExcerpt'] == 'true' && $count > $spotlightItems) { | |
| 651 | + | |
| 652 | + $excerpt = blockspare_excerpt($post_id, $attributes['excerptLength']); | |
| 653 | + $new_excerpt = apply_filters('the_excerpt', $excerpt); ?> | |
| 654 | + <!-- blockspare-posts-block-post-grid-excerpt --> | |
| 655 | + <?php if ($attributes['displayPostExcerpt'] && $new_excerpt != null) { ?> | |
| 656 | + <div class="blockspare-posts-block-post-grid-excerpt"> | |
| 657 | + <!-- blockspare-posts-block-post-grid-excerpt-content --> | |
| 658 | + <?php if (isset($attributes['displayPostExcerpt']) && $attributes['displayPostExcerpt'] == 'true' && $count > $spotlightItems) { ?> | |
| 659 | + <div class="blockspare-posts-block-post-grid-excerpt-content"> | |
| 660 | + <?php echo wp_kses_post($excerpt); ?> | |
| 661 | + </div> | |
| 662 | + <?php } ?> | |
| 663 | + <!-- blockspare-posts-block-post-grid-excerpt-content --> | |
| 664 | + <!-- blockspare-posts-block-post-grid-more-link --> | |
| 665 | + <?php if (isset($attributes['displayPostLink']) && $attributes['displayPostLink'] == 'true' && $count > $spotlightItems) { ?> | |
| 666 | + <p> | |
| 667 | + <a | |
| 668 | + class="blockspare-posts-block-post-grid-more-link blockspare-posts-block-text-link" | |
| 669 | + href="<?php echo esc_url(get_permalink($post_id)); ?>" | |
| 670 | + aria-label="<?php echo sprintf(esc_attr__('Read more about %s', 'blockspare'), esc_html(get_the_title($post_id))); ?>"> | |
| 671 | + <span aria-hidden="true"><?php echo esc_html($attributes['readMoreText']); ?></span> | |
| 672 | + </a> | |
| 673 | + | |
| 674 | + </p> | |
| 675 | + <?php } ?> | |
| 676 | + <!-- blockspare-posts-block-post-grid-more-link --> | |
| 677 | + </div> | |
| 678 | + <?php } | |
| 679 | + } ?> | |
| 680 | + <!-- blockspare-posts-block-post-grid-excerpt --> | |
| 681 | + | |
| 682 | + </div> | |
| 683 | +<?php } | |