Force Sidebar on Full Width page

Question

Any WP theme editor php gurus out there? So I’m using a theme that allows me to force all pages to full width. I have over 10,000 pages. It also forces my posts to full width too. I’m pretty sure I can edit single.php and force the right sidebar to show up but i’m having difficulty doing so. Any help is greatly appreciated. Here’s the contents of my single.php file.

The end result is to have only my posts have right sidebar and not my pages that are already full width.

Thanks in advance!

<?php
/**
 * The Template for displaying all single posts.
 *
 * @package zerif
 */

    get_header();

    $sidebar_layout = apply_filters( 'zerif_sidebar_layout', get_theme_mod( 'zerif_blog_sidebar_layout', 'sidebar-right' ) );
    $wrapper_class  = 'content-left-wrap col-md-9';

if ( 'full-width' === $sidebar_layout ) {
    $wrapper_class = 'content-left-wrap col-md-12';
}
?>
    <div class="clear"></div>
</header> <!-- / END HOME SECTION  -->
<?php
zerif_after_header_trigger();

if ( apply_filters( 'zerif_display_area_filter', true, 'single' ) ) {
    $zerif_change_to_full_width = get_theme_mod( 'zerif_change_to_full_width' );
    ?>
    <div id="content" class="site-content">
        <div class="container">
            <?php
            zerif_before_single_post_trigger();

            if ( $sidebar_layout === 'sidebar-right' && empty( $zerif_change_to_full_width ) || is_singular('post')) {
    zerif_sidebar_trigger();
}
            if(is_singular('post')){
    echo '<div class="content-left-wrap col-md-9">';
}elseif ( ! empty( $zerif_change_to_full_width ) || 'full-width' === $wrapper_class ) {
    echo '<div class="content-left-wrap col-md-12">';
} else {
    echo '<div class="content-left-wrap col-md-9">';
}

            ?>
            <?php zerif_top_single_post_trigger(); ?>
            <div id="primary" class="content-area">
                <main itemscope itemtype="http://schema.org/WebPageElement" itemprop="mainContentOfPage" id="main" class="site-main">
                    <?php
                    while ( have_posts() ) {
                        the_post();
                        get_template_part( 'content', 'single' );
                        zerif_post_nav();
                        /* If comments are open or we have at least one comment, load up the comment template */
                        if ( comments_open() || '0' != get_comments_number() ) {
                            comments_template( '' );
                        }
                    }
                    ?>
                </main><!-- #main -->
            </div><!-- #primary -->
            <?php zerif_bottom_single_post_trigger(); ?>
        </div><!-- .content-left-wrap -->
        <?php
        zerif_after_single_post_trigger();

        if ( $sidebar_layout === 'sidebar-right' && empty( $zerif_change_to_full_width ) ) {
            zerif_sidebar_trigger();
        }
        ?>
    </div><!-- .container -->
    </div>
    <?php
}
get_footer(); ?>
0
, , michael2000 4 years 2020-03-09T23:50:41-05:00 0 Answers 100 views 0

Leave an answer

Browse
Browse