Title: Changing PHP code &#8211; will this work?
Last modified: October 12, 2023

---

# Changing PHP code – will this work?

 *  Resolved [sangredeespana](https://wordpress.org/support/users/sangredeespana/)
 * (@sangredeespana)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/changing-php-code-will-this-work/)
 * It seems to work fine. I am not sure about the bolded part. Do I need it twice
   or just once since its part of the same <>php or do I need it twice since I have
   two different ID class.
 *     ```wp-block-code
       <?php
       /**
        * Header top.
        *
        * @package          Flatsome\Templates
        * @flatsome-version 3.16.0
        */
   
       if(flatsome_has_top_bar()['large_or_mobile']){ ?>
       <div id="top-bar" class="header-top <?php header_inner_class('top'); ?>">
           <div class="flex-row container">
             <div class="flex-col hide-for-medium flex-left">
                 <ul class="nav nav-left medium-nav-center nav-small <?php flatsome_nav_classes('top'); ?>">
                     <?php flatsome_header_elements('topbar_elements_left'); ?>
                 </ul>
             </div>
   
       		  <div class="flex-col hide-for-medium flex-center">
       			  <ul class="nav nav-center nav-small <?php flatsome_nav_classes('top'); ?>">
       				  <?php flatsome_header_elements('topbar_elements_center'); ?>
       			  </ul>
       		  </div>
   
       			  <div class="flex-col hide-for-medium flex-right">
       				 <ul class="nav top-bar-nav nav-right nav-small <?php flatsome_nav_classes('top'); ?>">
   
       				  </ul>
       			  </div>		
   
       				  <?php if(get_theme_mod('header_mobile_elements_top')) { ?>
       				  <div class="flex-col show-for-medium flex-grow">
       					  <ul class="nav nav-center nav-small mobile-nav <?php flatsome_nav_classes('top'); ?>">
       						  <?php flatsome_header_elements('header_mobile_elements_top'); ?>
       					  </ul>
       				  </div>
       				  <?php } ?>
           </div>
       </div>
   
   
       <div id="top-bar1" class="header-top <?php header_inner_class('top'); ?>">
           <div class="flex-row container">
             <div class="flex-col hide-for-medium flex-right">
                <ul class="nav top-bar-nav nav-right nav-small <?php flatsome_nav_classes('top'); ?>">
                    <?php flatsome_header_elements('topbar_elements_right'); ?>
                 </ul>
             </div>
   
       <?php
       /**
        * Header top.
        *
        * @package          Flatsome\Templates
        * @flatsome-version 3.16.0
        */
   
       if(flatsome_has_top_bar()['large_or_mobile']){ ?>
       <div id="top-bar" class="header-top <?php header_inner_class('top'); ?>">
           <div class="flex-row container">
             <div class="flex-col hide-for-medium flex-left">
                 <ul class="nav nav-left medium-nav-center nav-small <?php flatsome_nav_classes('top'); ?>">
                     <?php flatsome_header_elements('topbar_elements_left'); ?>
                 </ul>
             </div>
   
       		<div class="flex-col hide-for-medium flex-center">
       			<ul class="nav nav-center nav-small <?php flatsome_nav_classes('top'); ?>">
       				<?php flatsome_header_elements('topbar_elements_center'); ?>
       			</ul>
       		</div>
   
       		<div class="flex-col hide-for-medium flex-right">
       			<ul class="nav top-bar-nav nav-right nav-small <?php flatsome_nav_classes('top'); ?>">
       			</ul>
       		</div>		
   
       		<?php if(get_theme_mod('header_mobile_elements_top')) { ?>
       			<div class="flex-col show-for-medium flex-grow">
       				<ul class="nav nav-center nav-small mobile-nav <?php flatsome_nav_classes('top'); ?>">
       					<?php flatsome_header_elements('header_mobile_elements_top'); ?>
       				</ul>
       			</div>
       		<?php } ?>
           </div>
       </div>
   
   
       <div id="top-bar1" class="header-top <?php header_inner_class('top'); ?>">
           <div class="flex-row container">
             <div class="flex-col hide-for-medium flex-right">
                <ul class="nav top-bar-nav nav-right nav-small <?php flatsome_nav_classes('top'); ?>">
                    <?php flatsome_header_elements('topbar_elements_right'); ?>
                 </ul>
             </div>	
       			<?php if(get_theme_mod('header_mobile_elements_top')) { ?>
       				<div class="flex-col show-for-medium flex-grow">
       					<ul class="nav nav-center nav-small mobile-nav <?php flatsome_nav_classes('top'); ?>">
       						<?php flatsome_header_elements('header_mobile_elements_top'); ?>
       					</ul>
       				</div>
       			<?php } ?>		
           </div>
       </div>
   
       <?php } ?>
       ```
   
 * header-top.php (template-parts/header/header-top.php)
 * I call this twice, do I need to? If not the last one? Thx
 * `if(flatsome_has_top_bar()['large_or_mobile']){ ?> <div id="top-bar" class="header-
   top <?php header_inner_class('top'); ?>">`

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [sangredeespana](https://wordpress.org/support/users/sangredeespana/)
 * (@sangredeespana)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/changing-php-code-will-this-work/#post-17117801)
 * Basically this adds two instances of the top-header. The reason for the second
   instance was that everything was being squashed in the first one. So this creates
   a first instance, with menus in the flex box. Then creates a second one with 
   the other items offset to the right, below the first flex box.
 * ![](https://i0.wp.com/i.ibb.co/7K9Bqtk/Header-Top.png?ssl=1)
    -  This reply was modified 2 years, 8 months ago by [sangredeespana](https://wordpress.org/support/users/sangredeespana/).
    -  This reply was modified 2 years, 8 months ago by [sangredeespana](https://wordpress.org/support/users/sangredeespana/).
 *  Plugin Support [Lynn J.a11n](https://wordpress.org/support/users/lynnjat7/)
 * (@lynnjat7)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/changing-php-code-will-this-work/#post-17130620)
 * As this is fairly advanced custom code, we’d recommend sharing it with our developer
   community to see if another developer has had a similar experience.
    – You can
   post in the Advanced WooCommerce Facebook Group : [https://www.facebook.com/groups/advanced.woocommerce/](https://www.facebook.com/groups/advanced.woocommerce/)–
   You can join our WooCommerce Slack Community and ask there : [https://woocommerce.com/community-slack/](https://woocommerce.com/community-slack/)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Changing PHP code – will this work?’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Lynn J.a11n](https://wordpress.org/support/users/lynnjat7/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/changing-php-code-will-this-work/#post-17130620)
 * Status: resolved