mercredi 22 février 2017

wordpress if else statement for footer column base in class exist

i am making a theme in wordpress in which i add for footer, .footer-3c and .footer-3c

the main div control this class through variable when i change from backend the class automatic change, for 4 column class is .footer-4c and for 3 column class is .footer-3c.

here is my code:

i want to change this column class if class is .footer-3c then echo class .col-md-4 and if class is .footer-4c then echo class is .col-md-3


<?php
$footer_widgets = easysoftonic_get_option( 'footer_widgets' ) ? easysoftonic_get_option( 'footer_widgets' ) : "footer-3c" ;
if(  easysoftonic_get_option( 'footer_widgets_enable' ) ): ?>
<footer id="theme-footer">
    <div id="footer-widget-area" class="<?php echo $footer_widgets ?>">



    <?php if ( is_active_sidebar( 'first-footer-widget-area' ) ) : ?>
        <div id="footer-first" class="">
        <div class="col-md-3 md-margin-bottom-40">
            <?php dynamic_sidebar( 'first-footer-widget-area' ); ?>
        </div>
         </div>
    <?php endif; ?>

    <?php if ( is_active_sidebar( 'second-footer-widget-area' ) ) : ?>
        <div id="footer-second" class="">
         <div class="col-md-3 md-margin-bottom-40">
            <?php dynamic_sidebar( 'second-footer-widget-area' ); ?>
        </div>
         </div><!-- #second .widget-area -->
    <?php endif; ?>


    <?php if ( is_active_sidebar( 'third-footer-widget-area' ) ) : ?>
        <div id="footer-third" class="">
         <div class="col-md-3 md-margin-bottom-40">
            <?php dynamic_sidebar( 'third-footer-widget-area' ); ?>
        </div>
         </div><!-- #third .widget-area -->
    <?php endif; ?>

    <?php if ( is_active_sidebar( 'fourth-footer-widget-area' ) ) : ?>
        <div id="footer-fourth" class="">
         <div class="col-md-3 md-margin-bottom-40">
            <?php dynamic_sidebar( 'fourth-footer-widget-area' ); ?>
        </div>
         </div><!-- #fourth .widget-area -->
    <?php endif; ?>

    </div><!-- #footer-widget-area -->
    <div class="clear"></div>
</footer><!-- .Footer /-->
<?php endif; ?>

Aucun commentaire:

Enregistrer un commentaire