How can I move teh gridmarket theme multisite "store picker" to the sidebar widget?

I have a multisite network using gridmarket theme. I am customizing the header (using custom.css) to display "view cart" and "# items" flush-right. I have hidden the "search-bar" and placed one in the sidebar widget.

Next, I would like to hide the "mp-storepicker" (shop-list drop down menu), and place it in the sidebar widget. I see the script in the header.php, but it is over my head.

What is the best way to do this?

Thanks.

  • Vinod Dalvi

    Hi @MoniQ,

    I hope you are well today and thank you for your question.

    To remove "mp-storepicker" from header, just remove following code from header.php file.

    <?php  if ( is_multisite() ) {?>
    	<?php
    		$options = get_option('framemarket_theme_options');
    		$showpicker = isset($options['pickerinput']) ? $options['pickerinput'] : '';
    		if ($showpicker == "Yes"){
    				?>
    			<div id="mp-storepicker">
    				<?php _e( 'Pick a store:', 'framemarket' ) ?>&nbsp;&nbsp;<?php framemarket_listall_shops(); ?>
    			</div>
    	<?php } ?>
    <?php } ?>

    To add it in sidebar, just add the following code in sidebar.php file where you want it to display

    <?php  if ( is_multisite() ) {?>
    		<?php
    			$options = get_option('framemarket_theme_options');
    			$showpicker = isset($options['pickerinput']) ? $options['pickerinput'] : '';
    			if ($showpicker == "Yes"){
    				?>
    				<h3 class="widgettitle"><?php _e('Pick a store:', 'framemarket'); ?></h3>
    				<div class="widget">
    				<div id="mp-storepicker">
    					<?php framemarket_listall_shops(); ?>
    				</div>
    				</div>
    		<?php } ?>
    <?php } ?>

    Don't forget to select "Yes" radio button for "Show shop picker?" field in theme options.

    Best Regards,

  • MoniQ

    No luck just yet. Here is what sidebar.php looks like after I pasted in the code.

    <?php include (get_template_directory() . '/buddypress/buddypress-globals.php'); ?>
    	<?php if($bp_existed == 'true') : ?>
    		<?php do_action( 'bp_before_sidebar' ) ?>
    	<?php endif; ?>
    		<div id="sidebar">
    				<div class="widget">
    					<?php if($bp_existed != 'true' || ($bp_existed == 'true' && bp_is_blog_page())) : ?>
    							<?php if ( is_active_sidebar( 'sidebar' ) ) { ?>
    									<?php dynamic_sidebar( 'sidebar' ); ?>
    							<?php }else{
    								?>
    								<?php if ( class_exists( 'MarketPress' ) ) {
    											?>
    															<h3 class="widgettitle"><?php _e('Categories', 'framemarket'); ?></h3>
    															<div class="widget">
    											<?php framemarket_mp_list_categories(); ?>
    											</div>
    
    <?php  if ( is_multisite() ) {?>
    		<?php
    			$options = get_option('framemarket_theme_options');
    			$showpicker = isset($options['pickerinput']) ? $options['pickerinput'] : '';
    			if ($showpicker == "Yes"){
    				?>
    				<h3 class="widgettitle"><?php _e('Pick a store:', 'framemarket'); ?></h3>
    				<div class="widget">
    				<div id="mp-storepicker">
    					<?php framemarket_listall_shops(); ?>
    				</div>
    				</div>
    		<?php } ?>
    <?php } ?>
    													<h3 class="widgettitle"><?php _e('Popular Products', 'framemarket'); ?></h3>
    													<div class="widget">
    									<?php mp_popular_products(); ?>
    									</div>
    													<h3 class="widgettitle"><?php _e('Tag Cloud', 'framemarket'); ?></h3>
    													<div class="widget">
    									<?php mp_tag_cloud(); ?>
    									</div>
    									<?php
    								}
    								?>
    
    									<h3 class="widgettitle"><?php _e('Meta', 'framemarket'); ?></h3>
    									<div class="widget">
    									<?php wp_register(); ?>
    									<?php wp_loginout(); ?>
    										<?php wp_meta(); ?>
    									</div>
    								<?php
    							} ?>
    					<?php endif ?>
  • Vinod Dalvi

    Hi @MoniQ,

    I think you have added widgets in sidebar therefore you can add it either before or after all sidebar widget. To place it after categories list widget, you have to create a new widget having "shop-picker" code or if you want to display only categories list widget, shop-picker widget and search form in sidebar then i can do it for you by changing your sidebar.php file.

    Can you please send in:

    - Mark to my attention
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Best Regards,

  • MoniQ

    Vinod, thank you! It seems the store-picker pull down menu is a challenge. I will try my best to provide you with what I have so far:

    In the side bar widget, I have the following widgets added:
    1) global product category list
    2) text (with "br" to add a space)
    3) search

    (I tried to add your script to a text widget called "store-picker", and placed it under the global product category list, but only the title displayed, not the pull down menu. I am guessing, in order to have that script stand alone, I may require something.)

    Next, the sidebar.php script is below, which only successfully displays the "visit a shop" store-picker where it sits now, just above the global product category list. (Placed anywhere else, it does not work. I am guessing it requires something else to make that pull down menu work, and play nicely with the other widgets.):

    <?php include (get_template_directory() . '/buddypress/buddypress-globals.php'); ?>
    	<?php if($bp_existed == 'true') : ?>
    		<?php do_action( 'bp_before_sidebar' ) ?>
    	<?php endif; ?>
    		<div id="sidebar">
    				<div class="widget">	
    
    <?php  if ( is_multisite() ) {?>
    		<?php
    			$options = get_option('framemarket_theme_options');
    			$showpicker = isset($options['pickerinput']) ? $options['pickerinput'] : '';
    			if ($showpicker == "Yes"){
    				?>
    				<h3 class="widgettitle"><?php _e('', 'framemarket'); ?></h3>
    				<div class="widget">
    				<div id="mp-storepicker">
    					<?php framemarket_listall_shops(); ?>
    				</div>
    				</div>
    		<?php } ?>
    <?php } ?>
    &nbsp;&nbsp;
    					<?php if($bp_existed != 'true' || ($bp_existed == 'true' && bp_is_blog_page())) : ?>
    							<?php if ( is_active_sidebar( 'sidebar' ) ) { ?>
    									<?php dynamic_sidebar( 'sidebar' ); ?>
    							<?php }else{
    								?>
    								<?php if ( class_exists( 'MarketPress' ) ) {
    											?>
    									<h3 class="widgettitle"><?php _e('Categories', 'framemarket'); ?></h3>
    									<div class="widget">
    									<?php framemarket_mp_list_categories(); ?>
    									</div>
    
    									<h3 class="widgettitle"><?php _e('Popular Products', 'framemarket'); ?></h3>
    									<div class="widget">
    									<?php mp_popular_products(); ?>
    									</div>
    									<h3 class="widgettitle"><?php _e('Tag Cloud', 'framemarket'); ?></h3>
    									<div class="widget">
    									<?php mp_tag_cloud(); ?>
    									</div>
    									<?php
    								}
    								?>
    
    									<h3 class="widgettitle"><?php _e('Meta', 'framemarket'); ?></h3>
    									<div class="widget">
    									<?php wp_register(); ?>
    									<?php wp_loginout(); ?>
    										<?php wp_meta(); ?>
    									</div>
    								<?php
    							} ?>
    					<?php endif ?>
    
    					<?php if($bp_existed == 'true' && !bp_is_blog_page()) : ?>
    
    						<?php do_action( 'bp_inside_before_sidebar' ) ?>
    							<?php if ( is_active_sidebar( 'sidebar-members' ) ) : ?>
    									<?php dynamic_sidebar( 'sidebar-members' ); ?>
    							<?php endif; ?>
    						<?php if ( is_user_logged_in() ) : ?>
    
    							<?php do_action( 'bp_before_sidebar_me' ) ?>
    
    							<div id="sidebar-me">
    								<h3 class="widgettitle"><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></h3>
    									<div class="widget">
    							<h4><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></h4>
    							<a class="button logout" href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>"><?php _e( 'Log Out', 'framemarket') ?></a>
    
    								<?php do_action( 'bp_sidebar_me' ) ?>
    								</div>
    							</div>
    
    							<?php do_action( 'bp_after_sidebar_me' ) ?>
    
    							<?php if ( function_exists( 'bp_message_get_notices' ) ) : ?>
    								<?php bp_message_get_notices(); /* Site wide notices to all users */ ?>
    							<?php endif; ?>
    
    						<?php else : ?>
    
    							<?php do_action( 'bp_before_sidebar_login_form' ) ?>
    								<h3 class="widgettitle"><?php _e('Login', 'framemarket'); ?></h3>
    								<div class="widget">
    							<p id="login-text">
    								<?php _e( 'To start connecting please log in first.', 'framemarket' ) ?>
    								<?php if ( bp_get_signup_allowed() ) : ?>
    									<?php printf( __( ' You can also <a href="%s" title="Create an account">create an account</a>.', 'framemarket' ), site_url( BP_REGISTER_SLUG . '/' ) ) ?>
    								<?php endif; ?>
    							</p>
    
    							<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login_post' ) ?>" method="post">
    								<label><?php _e( 'Username', 'framemarket' ) ?><br />
    								<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php if(isset($user_login))echo esc_attr(stripslashes($user_login)); ?>" tabindex="97" /></label>
    
    								<label><?php _e( 'Password', 'framemarket' ) ?><br />
    								<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" tabindex="98" /></label>
    
    							<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" tabindex="99" /> <?php _e( 'Remember Me', 'framemarket' ) ?></label></p>
    
    								<?php do_action( 'bp_sidebar_login_form' ) ?>
    								<input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
    								<input type="hidden" name="testcookie" value="1" />
    							</form>
    
    							<?php do_action( 'bp_after_sidebar_login_form' ) ?>
    							</div>
    						<?php endif; ?>
    
    						<?php /* Show forum tags on the forums directory */
    						if ( BP_FORUMS_SLUG == bp_current_component() && bp_is_directory() ) : ?>
    							<h3 class="widgettitle"><?php _e( 'Forum Topic Tags', 'framemarket' ) ?></h3>
    							<div class="widget">
    							<div id="forum-directory-tags" class="widget tags">
    								<?php if ( function_exists('bp_forums_tag_heat_map') ) : ?>
    									<div id="tag-text"><?php bp_forums_tag_heat_map(); ?></div>
    								<?php endif; ?>
    							</div>
    							</div>
    						<?php endif; ?>
    
    						<?php do_action( 'bp_inside_after_sidebar' ) ?>
    					<?php endif; ?>
    			</div>
    		</div>
    		<?php if($bp_existed == 'true') : ?>
    			<?php do_action( 'bp_after_sidebar' ) ?>
    		<?php endif; ?>
  • Vinod Dalvi

    Hi @MoniQ,

    Remove whatever new code you have added in sidebar.php file and add following code in functions.php file of theme then just add text widget in sidebar from admin side where you want to display shop picker and in that text widget add [store_picker]

    function store_picker_func( $atts ){
    	$output = '';
    	if ( is_multisite() ) {?>
    			<?php
    				$options = get_option('framemarket_theme_options');
    				$showpicker = isset($options['pickerinput']) ? $options['pickerinput'] : '';
    				if ($showpicker == "Yes"){
    					$output .= '<div id="mp-storepicker">';
    						$output .= __( 'Pick a store:', 'framemarket' );
    						$output .= '&nbsp;&nbsp;';
    						ob_start();
    						framemarket_listall_shops();
    						$output .= ob_get_clean();
    					$output .= '</div>';
    				} ?>
    	<?php }
    	return $output;
    }
    add_shortcode( 'store_picker', 'store_picker_func' );
    add_filter('widget_text', 'do_shortcode');

    Best Regards,

  • Vinod Dalvi

    Hi @MoniQ,

    1) remove "Search for:" text that goes with the search bar (it is on the same line as the store-picker)

    Just copy and paste searchform.php file from FrameMarket theme into GridMarket theme and remove "search for" text in the search bar so that you can keep those changes even upgrading FrameMarket theme.

    2) extend the width of the store-picker drop-down menu to match the side bar width.

    Add following CSS in style.css file of GridMarket theme.

    #sidebar #mp-storepicker {
    width: 100%;
    margin: 0;
    }
    
    #sidebar #mp-storepicker select {
    width: 100%;
    }

    Best Regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.