Program PHP Header to Float Logo when search field is present

65 Views Asked by At

I'm reconfiguring a header for a Wordpress Theme. I just want to do this simple function:

  • Float the Logo to the center of the header when a search field is not present.

There used to be widgets in place where the search field is when a visitor navigates to a products page. I'd like to instead remove the rule that was in place for the widgets and float the Logo center, unless there is a search box, then I'd like to keep the Logo at the left.

Here is the code:

<div id="logo" class="col-sm-3">
            <?php 
            $logourl = SNSSIMEN_THEME_URI.'/assets/img/logo.png';
            if ( snssimen_get_option('header_logo') && snssimen_get_option('header_logo','','url') !='' ){
                $logourl = snssimen_get_option('header_logo','','url');
            }
            ?>
            <a href="<?php echo esc_url( home_url('/') ) ?>" title="<?php echo esc_attr(get_bloginfo( 'sitename' )); ?>">
                <img src="<?php echo esc_url($logourl); ?>" alt="<?php echo esc_attr(get_bloginfo( 'sitename' )); ?>"/>
            </a>
        </div>
        <div class="header-right col-sm-9">
            <div class="header-right-inner">
                <div class="row">
                **<?php if ( $snssimen_topHeaderSidebar == 'header_sidebar'):?>
                    <?php if(is_active_sidebar('header_sidebar')) dynamic_sidebar('header_sidebar');?>**
                <?php else: // Header sidebar search box?>
                    <div class="col-md-8">
                        <div id="headerRightSearchForm">
                                <?php // Get Woocommerce categoies
                                $args = array(
                                    'taxonomy'      => 'product_cat',
                                    'orderby'       => 'name',
                                    'show_count'    => 0,
                                    'pad_counts'    => 0,
                                    'hierarchical'  => 0,
                                    'title_li'      => '',
                                    'hide_empty'    => 0
                                );
                                $all_categories = get_categories($args);
                                ?>

The coding in the asteriks is the coding for what was there, but is not there anymore. Any suggestions? Regards.

0

There are 0 best solutions below