Modifying Discovery Box question

Hey there. I am using Network Child w/ buddypress. I'd like to modify the discovery box to include a drop down for products and shops. I believe the code would look something like this:
<option value="shops">Shops</option>, etc. Would you please tell me what page I would modify to achieve this? I am using firebug and see where I would make the modification, but it doesn't tell me which page to modify and I am too dumb to know

  • Mason

    Hiya,

    This'll take a bit of work, but (as always) is doable :slight_smile:

    Start by copying the discovery-header.php file from network/library/components to the exact same directory (you may have to create it) in your network-child theme.

    Create a new file in your child theme root folder and name it functions.php.

    In functions.php add the following code and save the file:

    <?php
    function network_listall_shops(){
    	global $wpdb;
        $query = "SELECT blog_id FROM " . $wpdb->base_prefix . "blogs WHERE spam != '1' AND archived != '1' AND deleted != '1' AND public = '1' AND blog_id != '1' ORDER BY path";
    
        $blogs = $wpdb->get_results($query);
        ?>
    <select name="shoplist" onchange="document.location.href=this.options[this.selectedIndex].value;">
    	<option value="">Visit a shop</option>
    	<?php
        foreach($blogs as $blog){
            $blog_details = get_blog_details($blog->blog_id);
    ?>
    <option value="<?php echo $blog_details->siteurl; ?>"> <?php echo $blog_details->blogname; ?></option>
    <?php
        }
    ?>
     </select>
    <?php
    }
    ?>

    Open your new discover-header.php and go to line 15 and insert the following:

    <div id="nw-storepicker">
    	<?php _e( 'Pick a store:', TEMPLATE_DOMAIN ) ?>&nbsp;&nbsp;<?php network_listall_shops(); ?>
    	</div>

    This should be directly above the closing div tag for the searchbox.

    Save the file and refresh your theme page. You should now see the store selector in the discovery box. You'll have to do a bit of work to style it to display properly and match the theme. We gave the div an id of "nw-storepicker" so that you can easily style it to your liking.

    Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.