Skip to content

Commit

Permalink
adicionada Section Content, referente a #19
Browse files Browse the repository at this point in the history
  • Loading branch information
diegorojas committed Jun 16, 2019
1 parent 0877962 commit 39c827f
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 23 deletions.
5 changes: 4 additions & 1 deletion inc/customizer-selective-refresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ function coletivo_customizer_partials( $wp_customize ) {
// section content
array(
'id' => 'content',
'selector' => '.section-content',
'selector' => '.section-content-home',
'settings' => array(
'coletivo_content_content',
'coletivo_content_title',
'coletivo_content_subtitle',
'coletivo_content_fullwidth',
),
),

Expand Down
52 changes: 49 additions & 3 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ function coletivo_customize_register( $wp_customize ) {
'panel' => 'coletivo_content',
)
);
// Show Content
// Show Section Content
$wp_customize->add_setting( 'coletivo_content_disable',
array(
'sanitize_callback' => 'coletivo_sanitize_checkbox',
Expand All @@ -866,11 +866,27 @@ function coletivo_customize_register( $wp_customize ) {
)
);

// Show content full screen
$wp_customize->add_setting( 'coletivo_content_fullwidth',
array(
'sanitize_callback' => 'coletivo_sanitize_checkbox',
'default' => '',
)
);
$wp_customize->add_control( 'coletivo_content_fullwidth',
array(
'type' => 'checkbox',
'label' => esc_html__('Make content of section full screen', 'coletivo'),
'section' => 'coletivo_content_settings',
'description' => esc_html__('Check this box to make content section full screen.', 'coletivo'),
)
);

// Section ID
$wp_customize->add_setting( 'coletivo_content_id',
array(
'sanitize_callback' => 'coletivo_sanitize_text',
'default' => esc_html__('content', 'coletivo'),
'default' => esc_html__('content-home', 'coletivo'),
)
);
$wp_customize->add_control( 'coletivo_content_id',
Expand All @@ -888,6 +904,7 @@ function coletivo_customize_register( $wp_customize ) {
'panel' => 'coletivo_content',
)
);

// Select Page
$wp_customize->add_setting('coletivo_content_content',
array(
Expand All @@ -906,6 +923,35 @@ function coletivo_customize_register( $wp_customize ) {
)
) );

// Title
$wp_customize->add_setting( 'coletivo_content_title',
array(
'sanitize_callback' => 'sanitize_text_field',
'default' => esc_html__('Content', 'coletivo'),
)
);
$wp_customize->add_control( 'coletivo_content_title',
array(
'label' => esc_html__('Section Title', 'coletivo'),
'section' => 'coletivo_content_content',
'description' => '',
)
);
// Sub Title
$wp_customize->add_setting( 'coletivo_content_subtitle',
array(
'sanitize_callback' => 'sanitize_text_field',
'default' => esc_html__('Section subtitle', 'coletivo'),
)
);
$wp_customize->add_control( 'coletivo_content_subtitle',
array(
'label' => esc_html__('Section Subtitle', 'coletivo'),
'section' => 'coletivo_content_content',
'description' => '',
)
);

/*------------------------------------------------------------------------*/
/* End of Section Content
/*------------------------------------------------------------------------*/
Expand Down Expand Up @@ -2956,7 +3002,7 @@ function coletivo_customize_controls_enqueue_scripts(){
*/
function coletivo_get_customizer_priority ( $panel ) {
$panel = str_replace( array( 'coletivo_', '_panel' ), '', $panel );
$order = get_theme_mod( 'coletivo_sections_order', 'hero,features,yourslider,featuredpage,services,portfolio,videolightbox,gallery,team,news,contact,social' );
$order = get_theme_mod( 'coletivo_sections_order', 'hero,content,features,yourslider,featuredpage,services,portfolio,videolightbox,gallery,team,news,contact,social' );
$index = 129;
$order = explode( ',', $order );
foreach ( $order as $key => $value ) {
Expand Down
58 changes: 41 additions & 17 deletions section-parts/section-content.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
$coletivo_content_id = get_theme_mod( 'coletivo_content_id', esc_html__('content', 'coletivo') );
$coletivo_content_disable = get_theme_mod( 'coletivo_content_disable' ) == 1 ? true : false ;
$title = get_theme_mod( 'coletivo_content_title', esc_html__('Content', 'coletivo' ));
$subtitle = get_theme_mod( 'coletivo_content_subtitle', esc_html__('Section subtitle', 'coletivo' ));
$coletivo_content_fullwidth_enable = get_theme_mod( 'coletivo_content_fullwidth' ) == 1 ? true : false ;
if ( coletivo_is_selective_refresh() ) {
$coletivo_content_disable = false;
}
Expand All @@ -17,28 +20,49 @@
setup_postdata( $post );
?>
<section style="<?php echo esc_attr( $style );?>" id="<?php if ($coletivo_content_id != '') {
echo $coletivo_content_id;
}; ?>" <?php do_action('coletivo_section_atts', 'content'); ?> class="<?php echo esc_attr(apply_filters('coletivo_section_class', 'section-content section-padding onepage-section', 'content')); ?>">
echo $coletivo_content_id; }; ?>" <?php do_action('coletivo_section_atts', 'content'); ?> class="section-content-home section-padding">

<div class="content">
<div class="container">
<?php do_action('coletivo_section_before_inner', 'content'); ?>
<div class="section-title-area">
<h2 class="section-title"><?php the_title(); ?></h2>
<div class="section-desc">
<?php
the_content();
?>
</div>
<br />
</div>
<?php
wp_reset_postdata();
?>
<div class="title-area-<?php echo esc_attr( $layout ); ?> container">
<?php if ( $title || $subtitle ){ ?>
<div class="section-title-area">
<?php if ($subtitle != '') echo '<h5 class="section-subtitle">' . esc_html($subtitle) . '</h5>'; ?>
<?php if ($title != '') echo '<h2 class="section-title">' . esc_html($title) . '</h2>'; ?>
<?php } ?>
</div>
<?php if ($coletivo_content_fullwidth_enable === false ) { ?>
<div class="section-content-area">
<div class="section-desc">
<?php
the_content();
?>
</div>
</div>
<?php
wp_reset_postdata();
?>
<?php } ?>
</div>
</div>

<?php if ($coletivo_content_fullwidth_enable === true ) { ?>
<div class="section-content-fullwidth">
<div class="section-desc">
<?php
the_content();
?>
</div>
</div>
<?php
wp_reset_postdata();
?>
<?php } ?>

</div>
</div>
<?php do_action('coletivo_section_after_inner', 'content'); ?>
<?php if ( ! has_post_thumbnail( $post_id ) ) ?>
</section>
<?php }
}
<?php } ?>
<?php }
20 changes: 19 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2064,10 +2064,28 @@ section > .customize-partial-edit-shortcut {
}

.section-title-area {
margin-bottom: 60px;
margin-bottom: 40px;
text-align: center;
}

.section-content-area {
margin-top: -20px;
margin-bottom: 0px;
text-align: center;
}

.section-content-fullwidth {
margin-top: -20px;
margin-bottom: 20px;
width: 100% !important;
}

.section-content-home {
display: block;
overflow: hidden;
}


.section-title-area .section-title {
font-size: 30px;
letter-spacing: 2px;
Expand Down
2 changes: 1 addition & 1 deletion template-frontpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

if ( ! has_action( 'coletivo_frontpage_section_parts' ) ) {

$order = get_theme_mod( 'coletivo_sections_order', 'hero,features,yourslider,featuredpage,services,portfolio,videolightbox,gallery,team,news,contact,social' );
$order = get_theme_mod( 'coletivo_sections_order', 'hero,content,features,yourslider,featuredpage,services,portfolio,videolightbox,gallery,team,news,contact,social' );
$order = explode( ',', $order );
$sections = apply_filters( 'coletivo_frontpage_sections_order', $order );

Expand Down

0 comments on commit 39c827f

Please sign in to comment.