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