Commit 18bc5ec6 authored by Michael Iseard's avatar Michael Iseard
Browse files

Remove unused blocks

parent 456de242
......@@ -52,7 +52,6 @@ function we_theme_options() {
// Email tab
->add_tab( 'Email',
array(
// Field::make( 'separator', 'crb_separator', __( 'Separator' , 'kudos-website') ),
Field::make( 'checkbox', 'we_use_smtp', __( 'Enable SMTP', 'kudos-website' ) )
->set_help_text( 'Enable use of external SMTP server.' )
->set_option_value( 'yes' ),
......@@ -134,115 +133,6 @@ function we_theme_options() {
->set_required(),
] );
Block::make( 'WE Savings Calculator' )
->add_fields( [
Field::make( 'text',
'text',
__( 'Display text, use {{ number }} for house type and {{ saving }} for savings', 'kudos-website' ) )
->set_default_value( 'Eeen gemiddeld {{ number }} bespaart tot {{ saving }} per jaar!' ),
Field::make( 'color', 'background_color', __( 'Background Color', 'kudos-website' ) )
->set_default_value( '#ffba08' ),
] )
->set_description( __( 'Adds an interactive widget fpr calculating energy savings.', 'kudos-website' ) )
->set_category( 'widgets' )
->set_icon( 'admin-users' )
->set_keywords( [ __( 'widget', 'kudos-website' ) ] )
->set_render_callback( function ( $fields ) {
$values_array = carbon_get_theme_option( 'household_values' );
$total_values = count( $values_array );
$text = $fields['text'];
$color = $fields['background_color'];
$vars = [
'{{ number }}' => '<span class="household-count">' . $values_array[ $total_values - 1 ]["title"] . '</span>',
'{{ saving }}' => '<span class="saving-amount">' . $values_array[ $total_values - 1 ]["amount"] . '</span>',
];
$filtered_text = strtr( $text, $vars );
// Generate random genders
$genders = [ 'male', 'female' ];
$n = 1;
$people = '';
while ( $n <= $total_values ) {
$class = 'selected';
$people .= '<a class="person ' . $class . '" href="#"><i class="fa-4x fas fa-' . array_random( $genders ) . ' mx-2"></i></a>';
$n ++;
}
?>
<div class="block-savings-calculator row">
<div class='col-12 text-center p-5 mb-4'>
<div style='background-color: <?php echo $color ?>' class="background"></div>
<p class="lead mb-4"><?php echo $filtered_text ?></p>
<div>
<?php echo $people; ?>
</div>
</div>
</div>
<?php
} );
Block::make( 'WE Reviews' )
->add_fields( [
Field::make( 'color', 'background_color', __( 'Background Color', 'kudos-website' ) )
->set_default_value( '#09814A' ),
] )
->set_description( __( 'Adds a widget showing random reviews.', 'kudos-website' ) )
->set_category( 'widgets' )
->set_icon( 'admin-comments' )
->set_keywords( [ __( 'widget', 'kudos-website' ) ] )
->set_render_callback( function ( $fields ) {
$color = $fields['background_color'];
$args = [
'post_type' => 'reviews',
'limit' => 5,
'order' => 'DESC',
];
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : ?>
<div class="block-reviews row">
<div class='col-12 text-center p-5 mb-4'>
<div style='background-color: <?php echo $color ?>' class="background"></div>
<?php
$n = 1;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$stars = carbon_get_post_meta( get_the_ID(), 'review_stars' );
$show_name = carbon_get_post_meta( get_the_ID(), 'show_reviewer_name' )
?>
<article
class="<?php echo( ( $n === 1 ) ? 'current ' : '' ) ?>d-flex align-items-center justify-content-between">
<div class="review">
<h4 class="content"><?php the_content() ?></h4>
<?php if ( $show_name ) { ?>
<p class="name"><?php the_title(); ?></p>
<?php } ?>
</div>
<div class="stars">
<?php
if ( $stars > 0 ) :
while ( $stars > 0 ):
?>
<i class="fas fa-2x fa-star"></i>
<?php
$stars --;
endwhile;
endif;
?>
</div>
</article>
<?php
$n ++;
endwhile;
wp_reset_postdata();
?>
</div><!-- .col-12 -->
</div><!-- .block-reviews -->
<?php
endif;
} );
}
add_action( 'after_setup_theme', 'crb_load' );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment