| @@ -1,276 +1,238 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - if(!function_exists('blockspare_render_block_core_latest_posts_grid')){ | |
| 4 | - function blockspare_render_block_core_latest_posts_grid($attributes) | |
| 5 | - { | |
| 6 | - | |
| 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 | - } | |
| 16 | 2 | |
| 17 | - $block_class = 'blockspare-posts-block-is-grid'.' has-gutter-'.$attributes['gutterSpace'];;; | |
| 18 | - $design = $attributes['grid']; | |
| 19 | - | |
| 20 | - blockspare_query_loop_and_wrapper($attributes,$block_class,$design); | |
| 21 | - $data_content = latest_posts_style_control_grid($blockuniqueclass ,$attributes); | |
| 22 | - $data_content .= ob_get_clean(); | |
| 23 | - return $data_content; | |
| 24 | - | |
| 25 | - } | |
| 26 | -} | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * Registers the post grid block on server | |
| 30 | - */ | |
| 31 | - if(!function_exists('blockspare_register_block_core_latest_posts_grid')){ | |
| 32 | - function blockspare_register_block_core_latest_posts_grid() | |
| 33 | - { | |
| 34 | - | |
| 35 | - if (!function_exists('register_block_type')) { | |
| 36 | - return; | |
| 37 | - } | |
| 38 | - | |
| 39 | - | |
| 40 | - ob_start(); | |
| 41 | - include BLOCKSPARE_PLUGIN_DIR . 'inc/latest-post-block/posts-grid/block.json'; | |
| 42 | - $metadata = json_decode(ob_get_clean(), true); | |
| 43 | - | |
| 44 | - /* Block attributes */ | |
| 45 | - register_block_type( | |
| 46 | - 'blockspare/blockspare-latest-posts-grid', | |
| 47 | - array( | |
| 48 | - 'attributes' =>$metadata['attributes'], | |
| 49 | - 'render_callback' => 'blockspare_render_block_core_latest_posts_grid', | |
| 50 | - ) | |
| 51 | - ); | |
| 52 | - } | |
| 53 | - | |
| 54 | - add_action('init', 'blockspare_register_block_core_latest_posts_grid'); | |
| 55 | -} | |
| 56 | - | |
| 57 | - if(!function_exists('latest_posts_style_control_grid')){ | |
| 58 | - function latest_posts_style_control_grid($blockuniqueclass ,$attributes){ | |
| 59 | - | |
| 60 | - | |
| 61 | - $block_content =''; | |
| 62 | - $block_content .= '<style type="text/css">'; | |
| 63 | - $block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-latest-post-wrap{ | |
| 64 | - margin-top:' . $attributes['marginTop'] . 'px; | |
| 65 | - margin-bottom:' . $attributes['marginBottom'] . 'px; | |
| 66 | - margin-left:' . $attributes['marginLeft'] . 'px; | |
| 67 | - margin-right:' . $attributes['marginRight'] . 'px; | |
| 3 | +if (!function_exists('latest_posts_style_control_grid')) { | |
| 4 | + function latest_posts_style_control_grid($blockuniqueclass, $attributes) | |
| 5 | + { | |
| 6 | + | |
| 7 | + $inline_css = ''; | |
| 8 | + $inline_css .= blockspare_visibility_css($attributes, $blockuniqueclass); | |
| 9 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-wrap{ | |
| 10 | + margin-top:' . $attributes['marginTop'] . 'px; | |
| 11 | + margin-bottom:' . $attributes['marginBottom'] . 'px; | |
| 12 | + margin-left:' . $attributes['marginLeft'] . 'px; | |
| 13 | + margin-right:' . $attributes['marginRight'] . 'px; | |
| 14 | + }'; | |
| 15 | + | |
| 16 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ | |
| 17 | + padding-top:' . $attributes['contentPaddingTop'] . 'px; | |
| 18 | + padding-right:' . $attributes['contentPaddingRight'] . 'px; | |
| 19 | + padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; | |
| 20 | + padding-left:' . $attributes['contentPaddingLeft'] . 'px; | |
| 21 | + }'; | |
| 22 | + | |
| 23 | + $inline_css .= blockspare_posts_category_style( | |
| 24 | + $inline_css, | |
| 25 | + $attributes, | |
| 26 | + $blockuniqueclass, | |
| 27 | + $attributes['categoryTextColor'], | |
| 28 | + $attributes['categoryBackgroundColor'], | |
| 29 | + $attributes['categoryBorderColor'], | |
| 30 | + $attributes['secondCategoryTextColor'], | |
| 31 | + $attributes['secondCategoryBackgroundColor'], | |
| 32 | + $attributes['secondCategoryBorderColor'], | |
| 33 | + $attributes['thirdCategoryTextColor'], | |
| 34 | + $attributes['thirdCategoryBackgroundColor'], | |
| 35 | + $attributes['thirdCategoryBorderColor'], | |
| 36 | + ); | |
| 37 | + | |
| 38 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-byline{ | |
| 39 | + margin-top:' . $attributes['metaMarginTop'] . 'px' . '; | |
| 40 | + margin-bottom:' . $attributes['metaMarginBottom'] . 'px' . '; | |
| 41 | + margin-left:' . $attributes['metaMarginLeft'] . 'px' . '; | |
| 42 | + margin-right:' . $attributes['metaMarginRight'] . 'px' . '; | |
| 43 | + }'; | |
| 44 | + | |
| 45 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link{ | |
| 46 | + margin-top:' . $attributes['moreLinkMarginTop'] . 'px' . '; | |
| 47 | + margin-bottom:' . $attributes['moreLinkMarginBottom'] . 'px' . '; | |
| 48 | + margin-left:' . $attributes['moreLinkMarginLeft'] . 'px' . '; | |
| 49 | + margin-right:' . $attributes['moreLinkMarginRight'] . 'px' . '; | |
| 50 | + }'; | |
| 51 | + | |
| 52 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 53 | + color: ' . $attributes['postTitleColor'] . '; | |
| 54 | + }'; | |
| 55 | + | |
| 56 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ | |
| 57 | + color:' . $attributes['linkColor'] . '; | |
| 58 | + }'; | |
| 59 | + | |
| 60 | + | |
| 61 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ | |
| 62 | + color:' . $attributes['linkColor'] . '; | |
| 63 | + }'; | |
| 64 | + | |
| 65 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ | |
| 66 | + color:' . $attributes['generalColor'] . '; | |
| 67 | + }'; | |
| 68 | + | |
| 69 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ | |
| 70 | + color:' . $attributes['generalColor'] . '; | |
| 71 | + }'; | |
| 72 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count{ | |
| 73 | + color:' . $attributes['generalColor'] . '; | |
| 74 | + }'; | |
| 75 | + | |
| 76 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title{ | |
| 77 | + margin-top:' . $attributes['titleMarginTop'] . 'px' . '; | |
| 78 | + margin-bottom:' . $attributes['titleMarginBottom'] . 'px' . '; | |
| 79 | + margin-left:' . $attributes['titleMarginLeft'] . 'px' . '; | |
| 80 | + margin-right:' . $attributes['titleMarginRight'] . 'px' . '; | |
| 81 | + }'; | |
| 82 | + | |
| 83 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ | |
| 84 | + margin-top:' . $attributes['exceprtMarginTop'] . 'px' . '; | |
| 85 | + margin-bottom:' . $attributes['exceprtMarginBottom'] . 'px' . '; | |
| 86 | + margin-left:' . $attributes['exceprtMarginLeft'] . 'px' . '; | |
| 87 | + margin-right:' . $attributes['exceprtMarginRight'] . 'px' . '; | |
| 88 | + }'; | |
| 89 | + | |
| 90 | + $layoutstyle = explode('-', $attributes['grid']); | |
| 91 | + if ($layoutstyle[5] > 3) { | |
| 92 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img { | |
| 93 | + border-radius:' . $attributes['borderRadius'] . 'px' . '; | |
| 94 | + }'; | |
| 95 | + if ($attributes['enableBoxShadow']) { | |
| 96 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img { | |
| 97 | + box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 68 | 98 | }'; |
| 69 | - | |
| 70 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ | |
| 71 | - padding-top:' . $attributes['contentPaddingTop'] . 'px; | |
| 72 | - padding-right:' . $attributes['contentPaddingRight'] . 'px; | |
| 73 | - padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; | |
| 74 | - padding-left:' . $attributes['contentPaddingLeft'] . 'px; | |
| 99 | + } | |
| 100 | + } else { | |
| 101 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 102 | + border-radius:' . $attributes['borderRadius'] . 'px' . '; | |
| 103 | + background-color:' . $attributes['backGroundColor'] . ' | |
| 104 | + }'; | |
| 105 | + | |
| 106 | + if ($attributes['enableBoxShadow']) { | |
| 107 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 108 | + box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 75 | 109 | }'; |
| 76 | - | |
| 77 | - | |
| 78 | - | |
| 79 | - | |
| 80 | - if ($attributes['categoryLayoutOption'] == 'solid') { | |
| 81 | - | |
| 82 | - | |
| 83 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ | |
| 84 | - color:' . $attributes['categoryTextColor'] . "!important" . '; | |
| 85 | - background-color:' . $attributes['categoryBackgroundColor'] . "!important" . '; | |
| 86 | - border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; | |
| 87 | - }'; | |
| 88 | - | |
| 89 | - } else if ($attributes['categoryLayoutOption'] == 'border') { | |
| 90 | - | |
| 91 | - | |
| 92 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ | |
| 93 | - color:' . $attributes['categoryTextColor'] . "!important" . '; | |
| 94 | - background-color:' . "transparent" . '; | |
| 95 | - border:' . "1px solid" . $attributes['categoryBorderColor'] . '; | |
| 96 | - border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; | |
| 97 | - border-width:' . $attributes['categoryBorderWidth'] . "px" . '; | |
| 110 | + } | |
| 111 | + } | |
| 112 | + | |
| 113 | + //Title Hover | |
| 114 | + | |
| 115 | + if ($attributes['titleOnHover'] == 'lpc-title-hover') { | |
| 116 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-title-link:hover span{ | |
| 117 | + color: ' . $attributes['titleOnHoverColor'] . '; | |
| 98 | 118 | }'; |
| 99 | - | |
| 100 | - | |
| 101 | - | |
| 102 | - } else { | |
| 103 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ | |
| 104 | - color:' . $attributes['categoryTextColor'] . "!important" . '; | |
| 105 | - }'; | |
| 106 | - } | |
| 107 | - | |
| 108 | - | |
| 109 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category{ | |
| 110 | - margin-top:' . $attributes['categoryMarginTop'] . 'px' . '; | |
| 111 | - margin-bottom:' . $attributes['categoryMarginBottom'] . 'px' . '; | |
| 112 | - margin-left:' . $attributes['categoryMarginLeft'] . 'px' . '; | |
| 113 | - margin-right:' . $attributes['categoryMarginRight'] . 'px' . '; | |
| 114 | - }'; | |
| 115 | - | |
| 116 | - | |
| 117 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-byline{ | |
| 118 | - | |
| 119 | - margin-top:' . $attributes['metaMarginTop'] . 'px' . '; | |
| 120 | - margin-bottom:' . $attributes['metaMarginBottom'] . 'px' . '; | |
| 121 | - margin-left:' . $attributes['metaMarginLeft'] . 'px' . '; | |
| 122 | - margin-right:' . $attributes['metaMarginRight'] . 'px' . '; | |
| 123 | - }'; | |
| 124 | - | |
| 125 | - | |
| 126 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link{ | |
| 127 | - margin-top:' . $attributes['moreLinkMarginTop'] . 'px' . '; | |
| 128 | - margin-bottom:' . $attributes['moreLinkMarginBottom'] . 'px' . '; | |
| 129 | - margin-left:' . $attributes['moreLinkMarginLeft'] . 'px' . '; | |
| 130 | - margin-right:' . $attributes['moreLinkMarginRight'] . 'px' . '; | |
| 131 | - }'; | |
| 132 | - | |
| 133 | - | |
| 134 | - | |
| 135 | - | |
| 136 | - | |
| 137 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 138 | - color: ' . $attributes['postTitleColor'] . '; | |
| 139 | - | |
| 140 | - }'; | |
| 141 | - | |
| 142 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ | |
| 143 | - color:' . $attributes['linkColor'] . '; | |
| 144 | - }'; | |
| 145 | - | |
| 146 | - | |
| 147 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ | |
| 148 | - color:' . $attributes['linkColor'] . '; | |
| 149 | - }'; | |
| 150 | - | |
| 151 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ | |
| 152 | - color:' . $attributes['generalColor'] . '; | |
| 153 | - }'; | |
| 154 | - | |
| 155 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content,'.' .' . $blockuniqueclass . ' .comment_count{ | |
| 156 | - color:' . $attributes['generalColor'] . '; | |
| 157 | - | |
| 158 | - }'; | |
| 159 | - | |
| 160 | - | |
| 161 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title{ | |
| 162 | - margin-top:' . $attributes['titleMarginTop'] . 'px' . '; | |
| 163 | - margin-bottom:' . $attributes['titleMarginBottom'] . 'px' . '; | |
| 164 | - margin-left:' . $attributes['titleMarginLeft'] . 'px' . '; | |
| 165 | - margin-right:' . $attributes['titleMarginRight'] . 'px' . '; | |
| 119 | + } | |
| 120 | + | |
| 121 | + if ($attributes['titleOnHover'] == 'lpc-title-border') { | |
| 122 | + $inline_css .= ' .' . $blockuniqueclass . ' .lpc-title-border .blockspare-posts-block-post-grid-title .blockspare-posts-block-title-link span:hover{ | |
| 123 | + box-shadow: inset 0 -2px 0 0 ' . $attributes['titleOnHoverColor'] . '; | |
| 166 | 124 | }'; |
| 167 | - | |
| 168 | - | |
| 169 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ | |
| 170 | - margin-top:' . $attributes['exceprtMarginTop'] . 'px' . '; | |
| 171 | - margin-bottom:' . $attributes['exceprtMarginBottom'] . 'px' . '; | |
| 172 | - margin-left:' . $attributes['exceprtMarginLeft'] . 'px' . '; | |
| 173 | - margin-right:' . $attributes['exceprtMarginRight'] . 'px' . '; | |
| 174 | - }'; | |
| 125 | + } | |
| 175 | 126 | |
| 176 | - $layoutstyle = explode('-',$attributes['grid']); | |
| 177 | - if($layoutstyle[5] >3){ | |
| 178 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img img{ | |
| 179 | - border-radius:' . $attributes['borderRadius'] . 'px'.'; | |
| 180 | - | |
| 181 | - }'; | |
| 182 | - if($attributes['enableBoxShadow']){ | |
| 183 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-img img{ | |
| 184 | - box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 185 | - }'; | |
| 186 | - } | |
| 187 | - }else{ | |
| 188 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 189 | - border-radius:' . $attributes['borderRadius'] . 'px'.'; | |
| 190 | - background-color:'.$attributes['backGroundColor'].' | |
| 191 | - }'; | |
| 127 | + //Font Settings | |
| 192 | 128 | |
| 193 | - if($attributes['enableBoxShadow']){ | |
| 194 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ | |
| 195 | - box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; | |
| 196 | - }'; | |
| 197 | - } | |
| 198 | - } | |
| 129 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 130 | + font-size: ' . $attributes['postTitleFontSize'] . $attributes['titleFontSizeType'] . '; | |
| 131 | + ' . bscheckFontfamily($attributes['titleFontFamily']) . '; | |
| 132 | + ' . bscheckFontfamilyWeight($attributes['titleFontWeight']) . '; | |
| 133 | + line-height: ' . $attributes['postTitleLineHeight'] . '; | |
| 134 | + }'; | |
| 199 | 135 | |
| 136 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content { | |
| 137 | + font-size:' . $attributes['descriptionFontSize'] . $attributes['descriptionFontSizeType'] . '; | |
| 138 | + ' . bscheckFontfamily($attributes['descriptionFontFamily']) . '; | |
| 139 | + ' . bscheckFontfamilyWeight($attributes['descriptionFontWeight']) . '; | |
| 140 | + }'; | |
| 200 | 141 | |
| 201 | - | |
| 202 | - | |
| 203 | - | |
| 204 | - //Title Hover | |
| 205 | - | |
| 206 | - if($attributes['titleOnHover']=='lpc-title-hover') { | |
| 207 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-title-link:hover span{ | |
| 208 | - color: ' . $attributes['titleOnHoverColor'] . '; | |
| 209 | - | |
| 210 | - }'; | |
| 211 | - } | |
| 142 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span { | |
| 143 | + font-size:' . $attributes['postMetaFontSize'] . $attributes['postMetaFontSizeType'] . '; | |
| 144 | + ' . bscheckFontfamily($attributes['postMetaFontFamily']) . '; | |
| 145 | + ' . bscheckFontfamilyWeight($attributes['postMetaFontWeight']) . '; | |
| 146 | + }'; | |
| 212 | 147 | |
| 213 | - if($attributes['titleOnHover']=='lpc-title-border') { | |
| 214 | - $block_content .= ' .' . $blockuniqueclass . ' .lpc-title-border .blockspare-posts-block-post-grid-title .blockspare-posts-block-title-link span:hover{ | |
| 215 | - box-shadow: inset 0 -2px 0 0 ' . $attributes['titleOnHoverColor'] . '; | |
| 216 | - | |
| 217 | - }'; | |
| 218 | - } | |
| 219 | - | |
| 220 | - //Font Settings | |
| 221 | - | |
| 222 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 223 | - | |
| 224 | - font-size: ' . $attributes['postTitleFontSize'] . $attributes['titleFontSizeType'] . '; | |
| 225 | - | |
| 226 | - '.bscheckFontfamily($attributes['titleFontFamily']).'; | |
| 227 | - font-weight: ' . $attributes['titleFontWeight'] . '; | |
| 228 | - }'; | |
| 229 | - | |
| 230 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content { | |
| 231 | - font-size:' . $attributes['descriptionFontSize'] . $attributes['descriptionFontSizeType'] . '; | |
| 232 | - | |
| 233 | - '.bscheckFontfamily($attributes['descriptionFontFamily']).'; | |
| 234 | - font-weight: ' . $attributes['descriptionFontWeight'] . '; | |
| 148 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date { | |
| 149 | + font-size:' . $attributes['postMetaFontSize'] . $attributes['postMetaFontSizeType'] . '; | |
| 150 | + ' . bscheckFontfamily($attributes['postMetaFontFamily']) . '; | |
| 151 | + ' . bscheckFontfamilyWeight($attributes['postMetaFontWeight']) . '; | |
| 152 | + }'; | |
| 153 | + | |
| 154 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count { | |
| 155 | + font-size:' . $attributes['postMetaFontSize'] . $attributes['postMetaFontSizeType'] . '; | |
| 156 | + ' . bscheckFontfamily($attributes['postMetaFontFamily']) . '; | |
| 157 | + ' . bscheckFontfamilyWeight($attributes['postMetaFontWeight']) . '; | |
| 158 | + }'; | |
| 159 | + | |
| 160 | + $inline_css .= '@media (max-width: 1025px) { '; | |
| 161 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 162 | + font-size: ' . $attributes['titleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; | |
| 163 | + }'; | |
| 164 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content { | |
| 165 | + font-size:' . $attributes['descriptionFontSizeTablet'] . $attributes['descriptionFontSizeType'] . ' | |
| 166 | + }'; | |
| 167 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span { | |
| 168 | + font-size:' . $attributes['postMetaFontSizeTablet'] . $attributes['postMetaFontSizeType'] . ' | |
| 169 | + }'; | |
| 170 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date { | |
| 171 | + font-size:' . $attributes['postMetaFontSizeTablet'] . $attributes['postMetaFontSizeType'] . ' | |
| 172 | + }'; | |
| 173 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count { | |
| 174 | + font-size:' . $attributes['postMetaFontSizeTablet'] . $attributes['postMetaFontSizeType'] . ' | |
| 175 | + }'; | |
| 176 | + $inline_css .= '}'; | |
| 177 | + | |
| 178 | + | |
| 179 | + $inline_css .= '@media (max-width: 767px) { '; | |
| 180 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 181 | + font-size: ' . $attributes['titleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; | |
| 182 | + }'; | |
| 183 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content { | |
| 184 | + font-size:' . $attributes['descriptionFontSizeMobile'] . $attributes['descriptionFontSizeType'] . ' | |
| 185 | + }'; | |
| 186 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span { | |
| 187 | + font-size:' . $attributes['postMetaFontSizeMobile'] . $attributes['postMetaFontSizeType'] . ' | |
| 188 | + }'; | |
| 189 | + $inline_css .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date { | |
| 190 | + font-size:' . $attributes['postMetaFontSizeMobile'] . $attributes['postMetaFontSizeType'] . ' | |
| 191 | + }'; | |
| 192 | + $inline_css .= ' .' . $blockuniqueclass . ' .comment_count { | |
| 193 | + font-size:' . $attributes['postMetaFontSizeMobile'] . $attributes['postMetaFontSizeType'] . ' | |
| 194 | + }'; | |
| 195 | + $inline_css .= '}'; | |
| 196 | + | |
| 197 | + //Pagination | |
| 198 | + if ($attributes['enablePagination']) { | |
| 199 | + if ($attributes['loadMoreStyle'] == 'bs-loadmore-solid') { | |
| 200 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn{ | |
| 201 | + color:' . $attributes['loadMoreSolidTextColor'] . '; | |
| 202 | + background-color:' . $attributes['loadMoreTextBgColor'] . '; | |
| 235 | 203 | }'; |
| 236 | - | |
| 237 | - $block_content .= '@media (max-width: 1025px) { '; | |
| 238 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 239 | - font-size: ' . $attributes['titleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; | |
| 204 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn:hover{ | |
| 205 | + color:' . $attributes['loadMoreSolidTextHoverColor'] . '; | |
| 206 | + background-color:' . $attributes['loadMoreTextBgHoverColor'] . '; | |
| 240 | 207 | }'; |
| 241 | - $block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content { | |
| 242 | - font-size:' . $attributes['descriptionFontSizeTablet'].$attributes['descriptionFontSizeType'].' | |
| 208 | + } else { | |
| 209 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn{ | |
| 210 | + color:' . $attributes['loadMoreTextColor'] . '; | |
| 243 | 211 | }'; |
| 244 | - $block_content .= '}'; | |
| 245 | - | |
| 246 | - | |
| 247 | - $block_content .= '@media (max-width: 768px) { '; | |
| 248 | - $block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ | |
| 249 | - font-size: ' . $attributes['titleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; | |
| 212 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .load-btn:hover{ | |
| 213 | + color:' . $attributes['loadMoreTextHoverColor'] . '; | |
| 250 | 214 | }'; |
| 251 | - $block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content { | |
| 252 | - font-size:' . $attributes['descriptionFontSizeMobile'].$attributes['descriptionFontSizeType'].' | |
| 215 | + } | |
| 216 | + | |
| 217 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore{ | |
| 218 | + text-align:' . $attributes['loadMoreAlignment'] . '; | |
| 253 | 219 | }'; |
| 254 | - $block_content .= '}'; | |
| 255 | - | |
| 256 | - //Pagination | |
| 257 | - if($attributes['enablePagination']){ | |
| 258 | - $block_content .=' .' . $blockuniqueclass . ' + .bs_blockspare_loadmore a.blockspare-readmore .load-btn{ | |
| 259 | - color:'.$attributes['loadMoreTextColor'].'; | |
| 260 | - background-color:'.$attributes['loadMoreTextBgColor'].'; | |
| 261 | - '.bscheckFontfamily($attributes['titleFontFamily']).'; | |
| 262 | - }'; | |
| 263 | - $block_content .=' .' . $blockuniqueclass . ' + .bs_blockspare_loadmore a.blockspare-readmore .ajax-loader-enabled{ | |
| 264 | - border-top-color:'.$attributes['loadMoreColor'].'; | |
| 265 | - }'; | |
| 266 | - $block_content .= '}'; | |
| 267 | - | |
| 268 | - } | |
| 269 | - | |
| 270 | - | |
| 271 | - $block_content .= '</style>'; | |
| 272 | - return $block_content; | |
| 220 | + $inline_css .= ' .' . $blockuniqueclass . ' .bs_blockspare_loadmore a.blockspare-readmore .ajax-loader-enabled{ | |
| 221 | + border-top-color:' . $attributes['loadMoreColor'] . '; | |
| 222 | + }'; | |
| 223 | + $inline_css .= '}'; | |
| 273 | 224 | } |
| 225 | + | |
| 226 | + | |
| 227 | + // $block_content .= blockspare_minify_css($inline_css); | |
| 228 | + | |
| 229 | + // $block_content .= '</style>'; | |
| 230 | + // return $block_content; | |
| 231 | + | |
| 232 | + if (!empty($inline_css)) { | |
| 233 | + wp_register_style('bs-post-grid', false); | |
| 234 | + wp_enqueue_style('bs-post-grid'); | |
| 235 | + wp_add_inline_style('bs-post-grid', blockspare_minify_css($inline_css)); | |
| 236 | + } | |
| 237 | + } | |
| 274 | 238 | } |
| 275 | - | |
| 276 | - | |