[Solved] Using get_theme_mod with checkbox to display content


Here is a modified version of your original code. Your echo statement isn’t right and really isn’t necessary. It’s probably better to jump out of PHP like I’ve done in the code below. Also, the unnecessary else statement was removed:

<?php
$servicescontent = get_theme_mod( 'services-page', 1 );
$abc = get_theme_mod( 'services-check', 1 );
$mod = new WP_Query( array( 'page_id' => $servicescontent ) );

while ( $mod->have_posts() ) : $mod->the_post();
    if ( $abc == 1 ) { ?>
        <div class="section default-bg">
            <div class="container">
                <h1 id="services" class="text-center title"><?php the_title();?></h1>
                <div class="space"></div>
                <div class="row">
                    <?php the_content();?>
                </div>
            </div>
        </div><!-- section end --><?php 
    }
endwhile;

solved Using get_theme_mod with checkbox to display content