i still dont understand the categories and menus??

Hi,

We have a "global category list" widget what is very nice. But i want my categories menu on top of the page as normal menu not as a sidebar menu.
how can achive this?

I did a custom menu with my "product categoreis" but it does not behave the same like the "global categore list",
the global list categorie don't show any categories when is empty, this is what i want in my top menu.

anyideas how this can be made?

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    This would have to be done through custom development within your theme. Check for a function such as wp_nav probably in your theme header and then you'd need to add the function that lists your categories.

    The process will be a bit different depending on the theme, but should be very similar to the above.

    Thanks!

  • erikjohansson
    • The Incredible Code Injector

    Hi :wink:

    i am using product theme any ideas how it could be made?
    i am baffeld (i am wordpress newbie) that is not an easy way to do a normal Nav menu with the product categoreis from marketpress and with any of the wpmu themes.

    i thought a top menu that works the i sameway as the sidebar menu should be an options. or i am wrong?

  • Mason
    • DEV MAN’s Sidekick

    I'm guessing that the sidebar menu you're referring to is the one in the GridMarket correct? This is a theme coded by us specifically to work with MarketPress - which is why it displays the categories by default.

    Also, WordPress menus are different from widget areas such as sidebar. That's simply the way WordPress works.

    You could even just grab that code from GridMarket and use it in your theme. You'd need to copy the following into your functions.php file:

    function product_mp_list_categories( $echo = true, $args = '' ) {
      $args['taxonomy'] = 'product_category';
      $args['echo'] = false;
      $args['title_li'] = '';
    
      $list = '<ul class="sf-menu">' . wp_list_categories( $args ) . '</ul>';
    
      if ($echo)
        echo $list;
      else
        return $list;
    }

    And then put the following wherever you want the list to show up (such as on line 3 of navigation.php inside product/library/components):
    <?php product_mp_list_categories(); ?>

    Hope that helps.

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    It would be very similar I imagine. I customized the script to output the correct classes that the product theme menu expects. This makes it look styled correctly. You'd have to do the same for SimpleMarket. You could try the default exactly as we have above and see what you get, if it looks a bit odd it's probably just in need of some styling assistance.

    Thanks!

  • erikjohansson
    • The Incredible Code Injector

    i got it fixed by change the top from 40px to 36px
    .sf-menu li.sfHover ul{left:0;top:36px;/* match top ul list item height */
    z-index:998;}

    i love firebug :slight_smile:

    Masonjames one more thing as i added your code to functions.php if i update simplemarket will i lose the code?

  • Mason
    • DEV MAN’s Sidekick

    Nicely done erik! :slight_smile:

    i love firebug :slight_smile:

    Yes. It kinda opens a whole new world up :slight_smile:

    Masonjames one more thing as i added your code to functions.php if i update simplemarket will i lose the code?

    Yeah, you will. Best practice is to make a backup (and a secondary backup) and even create a document that details what you changed. I'm always surprised at how quickly I forget what modifications I made to something. Having a doc that tells me what I did and why is really useful.

    There are also programs available that will compare 2 files for you and show you the differences. This is really helpful when updating your products and wanting to keep your own customizations.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.