| @@ -9,27 +9,21 @@ | ||
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -$layout_preset = isset( $layout['pcp_layout_preset'] ) ? $layout['pcp_layout_preset'] : ''; | |
| 14 | -$section_title = isset( $view_options['section_title'] ) ? $view_options['section_title'] : false; | |
| 15 | - | |
| 13 | +$view_options = get_post_meta( $pcp_id, 'sp_pcp_view_options', true ); | |
| 14 | +$layouts = get_post_meta( $pcp_id, 'sp_pcp_layouts', true ); | |
| 15 | +$layout = isset( $layouts['pcp_layout_preset'] ) ? $layouts['pcp_layout_preset'] : ''; | |
| 16 | 16 | // Section Title. |
| 17 | -if ( $section_title ) { | |
| 18 | - $section_title_margin = isset( $view_options['section_title_margin'] ) && is_array( $view_options['section_title_margin'] ) ? $view_options['section_title_margin'] : array( | |
| 19 | - 'top' => '0', | |
| 20 | - 'right' => '0', | |
| 21 | - 'bottom' => '30', | |
| 22 | - 'left' => '0', | |
| 23 | - ); | |
| 24 | - $section_title_margin_top = (int) $section_title_margin ['top'] > 0 ? $section_title_margin ['top'] . 'px' : 0; | |
| 25 | - $section_title_margin_right = (int) $section_title_margin['right'] > 0 ? $section_title_margin['right'] . 'px' : 0; | |
| 26 | - $section_title_margin_bottom = (int) $section_title_margin['bottom'] > -50 ? (int) $section_title_margin['bottom'] . 'px' : 0; | |
| 27 | - $section_title_margin_left = (int) $section_title_margin['left'] > 0 ? $section_title_margin['left'] . 'px' : 0; | |
| 28 | - $_section_title_color = isset( $view_options['section_title_typography']['color'] ) ? $view_options['section_title_typography']['color'] : '#111'; | |
| 29 | - $custom_css .= "#poststuff #sp_pcp_display .sp-pcp-section .pcp-section-title, #pcp_wrapper-{$pcp_id} .pcp-section-title{color: {$_section_title_color };margin: {$section_title_margin_top} {$section_title_margin_right} {$section_title_margin_bottom} {$section_title_margin_left}}"; | |
| 17 | +if ( $view_options['section_title'] ) { | |
| 18 | + $section_title_margin_top = $view_options['section_title_margin']['top'] > 0 ? $view_options['section_title_margin']['top'] . 'px' : 0; | |
| 19 | + $section_title_margin_right = $view_options['section_title_margin']['right'] > 0 ? $view_options['section_title_margin']['right'] . 'px' : 0; | |
| 20 | + $section_title_margin_bottom = $view_options['section_title_margin']['bottom'] > 0 ? $view_options['section_title_margin']['bottom'] . 'px' : 0; | |
| 21 | + $section_title_margin_left = $view_options['section_title_margin']['left'] > 0 ? $view_options['section_title_margin']['left'] . 'px' : 0; | |
| 22 | + $_section_title_typography = $view_options['section_title_typography']; | |
| 23 | + $custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-section-title{color: {$_section_title_typography['color']};margin: {$section_title_margin_top} {$section_title_margin_right} {$section_title_margin_bottom} {$section_title_margin_left}}"; | |
| 30 | 24 | } |
| 31 | -$margin_between_post = isset( $view_options['margin_between_post']['all'] ) ? (int) $view_options['margin_between_post']['all'] : 20; | |
| 25 | +$margin_between_post = (int) $view_options['margin_between_post']['all']; | |
| 32 | 26 | $margin_between_post_half = $margin_between_post / 2; |
| 33 | 27 | $custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-row{ margin-right: -{$margin_between_post_half}px;margin-left: -{$margin_between_post_half}px;}#pcp_wrapper-{$pcp_id} .sp-pcp-row [class*='sp-pcp-col-']{padding-right: {$margin_between_post_half}px;padding-left: {$margin_between_post_half}px;padding-bottom: {$margin_between_post}px;}"; |
| 34 | 28 | |
| 35 | 29 | /** |
| @@ -34,33 +28,27 @@ | ||
| 34 | 28 | |
| 35 | 29 | /** |
| 36 | 30 | * Style for each slide/post. |
| 37 | 31 | */ |
| 38 | -$post_sorter = isset( $view_options['post_content_sorter'] ) ? $view_options['post_content_sorter'] : ''; | |
| 39 | - | |
| 32 | +$post_sorter = $view_options['post_content_sorter']; | |
| 40 | 33 | // Post Title. |
| 41 | -if ( isset( $post_sorter['pcp_post_title']['show_post_title'] ) && $post_sorter['pcp_post_title']['show_post_title'] ) { | |
| 42 | - $_post_title_typography = isset( $view_options['post_title_typography'] ) && is_array( $view_options['post_title_typography'] ) ? $view_options['post_title_typography'] : array( | |
| 43 | - 'color' => '#111', | |
| 44 | - 'hover_color' => '#e1624b', | |
| 45 | - ); | |
| 34 | +if ( $post_sorter['pcp_post_title']['show_post_title'] ) { | |
| 35 | + $_post_title_typography = $view_options['post_title_typography']; | |
| 46 | 36 | $custom_css .= ".pcp-wrapper-{$pcp_id} .sp-pcp-title a {color: {$_post_title_typography['color']};display: inherit;} .pcp-wrapper-{$pcp_id} .sp-pcp-title a:hover {color: {$_post_title_typography['hover_color']};}"; |
| 47 | 37 | } |
| 48 | 38 | |
| 49 | 39 | // Post Content. |
| 50 | -$pcp_post_content = isset( $post_sorter['pcp_post_content'] ) ? $post_sorter['pcp_post_content'] : ''; | |
| 51 | -$show_post_content = isset( $pcp_post_content['show_post_content'] ) ? $pcp_post_content['show_post_content'] : ''; | |
| 52 | -if ( $show_post_content ) { | |
| 53 | - $_post_content_color = isset( $view_options['post_content_typography']['color'] ) ? $view_options['post_content_typography']['color'] : '#444'; | |
| 54 | - $custom_css .= ".pcp-wrapper-{$pcp_id} .sp-pcp-post-content{color: {$_post_content_color}; }"; | |
| 40 | +if ( $post_sorter['pcp_post_content']['show_post_content'] ) { | |
| 41 | + $_post_content_typography = $view_options['post_content_typography']; | |
| 42 | + $custom_css .= ".pcp-wrapper-{$pcp_id} .sp-pcp-post-content{color: {$_post_content_typography['color']}; }"; | |
| 55 | 43 | } |
| 56 | 44 | |
| 57 | -if ( 'carousel_layout' === $layout_preset ) { | |
| 45 | +if ( 'carousel_layout' === $layout ) { | |
| 58 | 46 | include SP_PC_PATH . '/public/dynamic-css/carousel-css.php'; |
| 59 | 47 | } |
| 60 | 48 | |
| 61 | 49 | // Post inner padding. |
| 62 | -$post_content_orientation = isset( $view_options['post_content_orientation'] ) ? $view_options['post_content_orientation'] : 'default'; | |
| 50 | +$post_content_orientation = $view_options['post_content_orientation']; | |
| 63 | 51 | if ( 'overlay' !== $post_content_orientation ) { |
| 64 | 52 | $_post_inner_padding = SP_PC_Functions::pcp_metabox_value( 'post_inner_padding_property', $view_options ); |
| 65 | 53 | $post_inner_padding_unit = $_post_inner_padding['unit']; |
| 66 | 54 | $post_inner_padding_top = $_post_inner_padding['top'] > 0 ? $_post_inner_padding['top'] . $post_inner_padding_unit : '0'; |
| @@ -79,11 +67,11 @@ | ||
| 79 | 67 | $custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-post {border: {$post_border_width}px {$post_border_style} {$post_border_color};}"; |
| 80 | 68 | } |
| 81 | 69 | |
| 82 | 70 | // Post background color. |
| 83 | -$post_background_property = SP_PC_Functions::pcp_metabox_value( 'post_background_property', $view_options ); | |
| 71 | +$post_background_property = SP_PC_Functions::pcp_metabox_value( 'post_background_property', $view_options ); | |
| 84 | 72 | $post_border_radius_property = SP_PC_Functions::pcp_metabox_value( 'post_border_radius_property', $view_options ); |
| 85 | -$custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-post {border-radius: {$post_border_radius_property['all']}px;}"; | |
| 73 | +$custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-post {border-radius: {$post_border_radius_property['all']};}"; | |
| 86 | 74 | if ( ! in_array( $post_content_orientation, array( 'overlay', 'overlay-box' ), true ) ) { |
| 87 | 75 | $custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-post{background-color: {$post_background_property};}"; |
| 88 | 76 | } |
| 89 | 77 | |
| @@ -92,19 +80,17 @@ | ||
| 92 | 80 | */ |
| 93 | 81 | $post_thumb_css = $post_sorter['pcp_post_thumb']; |
| 94 | 82 | |
| 95 | 83 | // Post Meta. |
| 96 | -$_post_meta_color = isset( $view_options['post_meta_typography']['color'] ) ? $view_options['post_meta_typography']['color'] : '#888'; | |
| 97 | -$_post_meta_hover_color = isset( $view_options['post_meta_typography']['hover_color'] ) ? $view_options['post_meta_typography']['hover_color'] : '#e1624b'; | |
| 98 | -$custom_css .= ".pcp-wrapper-{$pcp_id} .sp-pcp-post-meta li,.pcp-wrapper-{$pcp_id} .sp-pcp-post-meta ul,.pcp-wrapper-{$pcp_id} .sp-pcp-post-meta li a{color: {$_post_meta_color};}"; | |
| 99 | -$custom_css .= ".pcp-wrapper-{$pcp_id} .sp-pcp-post-meta li a:hover{color: {$_post_meta_hover_color};}"; | |
| 84 | +$_post_meta_typography = $view_options['post_meta_typography']; | |
| 85 | +$custom_css .= ".pcp-wrapper-{$pcp_id} .sp-pcp-post-meta li,.pcp-wrapper-{$pcp_id} .sp-pcp-post-meta ul,.pcp-wrapper-{$pcp_id} .sp-pcp-post-meta li a{color: {$_post_meta_typography['color']};}"; | |
| 86 | +$custom_css .= ".pcp-wrapper-{$pcp_id} .sp-pcp-post-meta li a:hover{color: {$_post_meta_typography['hover_color']};}"; | |
| 100 | 87 | |
| 101 | 88 | // Post ReadMore Settings. |
| 102 | -$post_content_settings = isset( $post_sorter['pcp_post_content'] ) ? $post_sorter['pcp_post_content'] : ''; | |
| 103 | -$show_read_more = isset( $post_content_settings['show_read_more'] ) ? $post_content_settings['show_read_more'] : ''; | |
| 104 | -if ( $show_read_more ) { | |
| 105 | - $_button_color = $post_content_settings['readmore_color_button']; | |
| 106 | - $custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-readmore-link{ background: {$_button_color['bg']}; color: {$_button_color['standard']}; border-color: {$_button_color['border']}; } #pcp_wrapper-{$pcp_id} .pcp-readmore-link:hover { background: {$_button_color['hover_bg']}; color: {$_button_color['hover']}; border-color: {$_button_color['hover_border']}; }"; | |
| 89 | +$post_content_settings = $post_sorter['pcp_post_content']; | |
| 90 | +if ( $post_content_settings['show_read_more'] ) { | |
| 91 | + $_button_color = $post_content_settings['readmore_color_button']; | |
| 92 | + $custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-readmore-link{ background: {$_button_color['bg']}; color: {$_button_color['standard']}; border-color: {$_button_color['border']}; } #pcp_wrapper-{$pcp_id} .pcp-readmore-link:hover { background: {$_button_color['hover_bg']}; color: {$_button_color['hover']}; border-color: {$_button_color['hover_border']}; }"; | |
| 107 | 93 | } |
| 108 | 94 | |
| 109 | 95 | // Pagination CSS and Live filter CSS. |
| 110 | 96 | $show_pagination = isset( $view_options['show_post_pagination'] ) ? $view_options['show_post_pagination'] : ''; |
| @@ -109,6 +95,6 @@ | ||
| 109 | 95 | // Pagination CSS and Live filter CSS. |
| 110 | 96 | $show_pagination = isset( $view_options['show_post_pagination'] ) ? $view_options['show_post_pagination'] : ''; |
| 111 | 97 | if ( $show_pagination ) { |
| 112 | 98 | $pagination_btn_color = $view_options['pcp_pagination_btn_color']; |
| 113 | - $custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-post-pagination .page-numbers.current, #pcp_wrapper-{$pcp_id} .pcp-post-pagination a.active , #pcp_wrapper-{$pcp_id} .pcp-post-pagination a:hover{ color: {$pagination_btn_color['text_acolor']}; background: {$pagination_btn_color['active_background']}; border-color: {$pagination_btn_color['border_acolor']}; }#pcp_wrapper-{$pcp_id} .pcp-post-pagination .page-numbers, .pcp-post-pagination a{ background: {$pagination_btn_color['background']}; color:{$pagination_btn_color['text_color']}; border-color: {$pagination_btn_color['border_color']}; }"; | |
| 99 | + $custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-post-pagination .page-numbers.current, #pcp_wrapper-{$pcp_id} .pcp-post-pagination a.active , #pcp_wrapper-{$pcp_id} .pcp-post-pagination a:hover{ color: {$pagination_btn_color['text_acolor']}; background: {$pagination_btn_color['active_background']}; border-color: {$pagination_btn_color['border_acolor']}; }#pcp_wrapper-{$pcp_id} .pcp-post-pagination .page-numbers, .pcp-post-pagination a{ background: {$pagination_btn_color['background']}; color:{$pagination_btn_color['text_color']}; border-color: {$pagination_btn_color['border_color']}; }"; | |
| 114 | 100 | } |