| 1 |
<?php |
| 2 |
|
| 3 |
if (!function_exists('blockspare_posts_category_style')) { |
| 4 |
|
| 5 |
function blockspare_posts_category_style( |
| 6 |
$block_content, |
| 7 |
$attributes, |
| 8 |
$blockuniqueclass, |
| 9 |
$color, |
| 10 |
$backgroundColor, |
| 11 |
$borderColor, |
| 12 |
$secondColor, |
| 13 |
$secondBackgroundColor, |
| 14 |
$secondBorderColor, |
| 15 |
$thirdColor, |
| 16 |
$thirdBackgroundColor, |
| 17 |
$thirdBorderColor |
| 18 |
) { |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
// border-radius |
| 23 |
if ($attributes['categoryLayoutOption'] == 'border' || $attributes['categoryLayoutOption'] == 'solid') { |
| 24 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 25 |
border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; |
| 26 |
}'; |
| 27 |
} |
| 28 |
|
| 29 |
// border |
| 30 |
if ($attributes['categoryLayoutOption'] == 'border') { |
| 31 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 32 |
border-style: solid; |
| 33 |
border-width:' . $attributes['categoryBorderWidth'] . "px" . '; |
| 34 |
}'; |
| 35 |
} |
| 36 |
|
| 37 |
// underline |
| 38 |
if ($attributes['categoryLayoutOption'] == 'underline') { |
| 39 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 40 |
border-bottom-style: solid; |
| 41 |
border-bottom-width:' . $attributes['categoryBorderWidth'] . "px" . '; |
| 42 |
padding-left: 0; |
| 43 |
padding-right: 0; |
| 44 |
}'; |
| 45 |
} |
| 46 |
|
| 47 |
// colors |
| 48 |
if ($attributes['colorType'] == 'bs-single-color') { |
| 49 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 50 |
color:' . $color . "!important" . '; |
| 51 |
}'; |
| 52 |
|
| 53 |
if ($attributes['categoryLayoutOption'] == 'solid') { |
| 54 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 55 |
background-color:' . $backgroundColor . "!important" . '; |
| 56 |
}'; |
| 57 |
} |
| 58 |
|
| 59 |
if ($attributes['categoryLayoutOption'] == 'border' || $attributes['categoryLayoutOption'] == 'underline') { |
| 60 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 61 |
border-color:' . $borderColor . '; |
| 62 |
}'; |
| 63 |
} |
| 64 |
} else { |
| 65 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n + 1){ |
| 66 |
color:' . $color . "!important" . '; |
| 67 |
}'; |
| 68 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n + 2){ |
| 69 |
color:' . $secondColor . "!important" . '; |
| 70 |
}'; |
| 71 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n){ |
| 72 |
color:' . $thirdColor . "!important" . '; |
| 73 |
}'; |
| 74 |
|
| 75 |
if ($attributes['categoryLayoutOption'] == 'solid') { |
| 76 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n + 1){ |
| 77 |
background-color:' . $backgroundColor . "!important" . '; |
| 78 |
}'; |
| 79 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n + 2){ |
| 80 |
background-color:' . $secondBackgroundColor . "!important" . '; |
| 81 |
}'; |
| 82 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n){ |
| 83 |
background-color:' . $thirdBackgroundColor . "!important" . '; |
| 84 |
}'; |
| 85 |
} |
| 86 |
|
| 87 |
if ($attributes['categoryLayoutOption'] == 'border' || $attributes['categoryLayoutOption'] == 'underline') { |
| 88 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n + 1){ |
| 89 |
border-color:' . $borderColor . '; |
| 90 |
}'; |
| 91 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n + 2){ |
| 92 |
border-color:' . $secondBorderColor . '; |
| 93 |
}'; |
| 94 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a:nth-child(3n){ |
| 95 |
border-color:' . $thirdBorderColor . '; |
| 96 |
}'; |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category{ |
| 101 |
margin-top:' . $attributes['categoryMarginTop'] . 'px' . '; |
| 102 |
margin-bottom:' . $attributes['categoryMarginBottom'] . 'px' . '; |
| 103 |
margin-left:' . $attributes['categoryMarginLeft'] . 'px' . '; |
| 104 |
margin-right:' . $attributes['categoryMarginRight'] . 'px' . '; |
| 105 |
}'; |
| 106 |
|
| 107 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a { |
| 108 |
font-size:' . $attributes['postCategoryFontSize'] . $attributes['postCategoryFontSizeType'] . '; |
| 109 |
' . bscheckFontfamily($attributes['postCategoryFontFamily']) . '; |
| 110 |
' . bscheckFontfamilyWeight($attributes['postCategoryFontWeight']) . '; |
| 111 |
}'; |
| 112 |
|
| 113 |
$block_content .= '@media (max-width: 1025px) { '; |
| 114 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a { |
| 115 |
font-size:' . $attributes['postCategoryFontSizeTablet'] . $attributes['postCategoryFontSizeType'] . ' |
| 116 |
}'; |
| 117 |
$block_content .= '}'; |
| 118 |
|
| 119 |
$block_content .= '@media (max-width: 767px) { '; |
| 120 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a { |
| 121 |
font-size:' . $attributes['postCategoryFontSizeMobile'] . $attributes['postCategoryFontSizeType'] . ' |
| 122 |
}'; |
| 123 |
$block_content .= '}'; |
| 124 |
|
| 125 |
return $block_content; |
| 126 |
} |
| 127 |
} |
| 128 |
|