Customizing a Drupal 7 block menu I installed the Menu block module, and it seems to work fine.

I need to change one of the menu HTML output; instead of the following HTML tags:

&lt;ul class="menu"&gt;
  &lt;li&gt;&lt;a href="/" title=""&gt;Home&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="/our-rides" title=""&gt;Our Rides&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


I want to have:

&lt;a href="/" title=""&gt;Home&lt;/a&gt;|&lt;a href="/our-rides" title=""&gt;Our Rides&lt;/a&gt;


I tried implementing a hook, but it doesn't work.

function bsrentals_menu_item_link__menu_block($variables) {
      print 123;exit;
}
Well, what you want to achieve ... Eg, output a horizontal list of links with "pipes" between them can be done in Drupal with the HTML and CSS drupal provides you.

What you need to refer to is a book on CSS.

A random Google of this technique yields:
http://jamesowers.co.uk/css-tutorials/50/horizontal-css-list-menu/

In a nutshell, you want to set the list-item as relative and to display inline in CSS. Give them some spacing and for instance add a right-border to every list item with your color choice. Then if you really want using a CSS/Jquery selector of :last-child remove the trailing right border if it bothers you.

If you are intent on rewriting and bending the HTML and CSS to your will because the above approach elludes you .... you can do 1 of 2 options:

1) using the http://drupal.org/project/devel_themer you can find the specific block in question within your theme. You can then alter the necessary template file(s) in drupal to alter the HTML produced from Drupal to meet your criteria. Menus are shown in blocks on the page. So you could find the theme function for the menu in question and override its output in your theme. Devel_theme should be able to tell you the correct function to override if your's isn't working.

Or you could create a really silly function like below in your template.php file and call it as needed from your .tpl files. The below code relies on the http://api.drupal.org/api/drupal/includes--menu.inc/function/menu_tree_all_data/7 function to pull a menu's items by the menu-name. See the linked API page to find out how to find out what specific menu in drupal you want to load ... then we simply create the HTML from the menu links as in the function. I really really dont recommend you do this. Either learn CSS and Jquery to render the default content drupal provides you with to appear as you want, or learn how to change the template files gracefully ...

/*
What does menu_tree_all_data() return ... well let's see below:

$ drush eval 'print_r(menu_tree_all_data("main-menu"));'Array
(
[49950 Home 240] =&gt; Array
    (
        [link] =&gt; Array
            (
                [menu_name] =&gt; main-menu
                [mlid] =&gt; 240
                [plid] =&gt; 0
                [link_path] =&gt; &lt;front&gt;
                [router_path] =&gt;
                [link_title] =&gt; Home
                [options] =&gt; Array
                    (
                        [attributes] =&gt; Array
                            (
                                [title] =&gt;
                            )

                    )

                [module] =&gt; menu
                [hidden] =&gt; 0
                [external] =&gt; 1
                [has_children] =&gt; 0
                [expanded] =&gt; 0
                [weight] =&gt; -50
                [depth] =&gt; 1
                [customized] =&gt; 1
                [p1] =&gt; 240
                [p2] =&gt; 0
                [p3] =&gt; 0
                [p4] =&gt; 0
                [p5] =&gt; 0
                [p6] =&gt; 0
                [p7] =&gt; 0
                [p8] =&gt; 0
                [p9] =&gt; 0
                [updated] =&gt; 0
                [load_functions] =&gt;
                [to_arg_functions] =&gt;
                [access_callback] =&gt;
                [access_arguments] =&gt;
                [page_callback] =&gt;
                [page_arguments] =&gt;
                [delivery_callback] =&gt;
                [tab_parent] =&gt;
                [tab_root] =&gt;
                [title] =&gt; Home
                [title_callback] =&gt;
                [title_arguments] =&gt;
                [theme_callback] =&gt;
                [theme_arguments] =&gt;
                [type] =&gt;
                [description] =&gt;
                [in_active_trail] =&gt;
                [access] =&gt; 1
                [href] =&gt; &lt;front&gt;
                [localized_options] =&gt; Array
                    (
                        [attributes] =&gt; Array
                            (
                                [title] =&gt;
                            )

                    )

            )

        [below] =&gt; Array
            (
            )

    )

[49951 Student Login 239] =&gt; Array
    (
        [link] =&gt; Array
            (
                [menu_name] =&gt; main-menu
                [mlid] =&gt; 239
                [plid] =&gt; 0
                [link_path] =&gt; student/login
                [router_path] =&gt; student/login
                [link_title] =&gt; Student Login
                [options] =&gt; Array
                    (
                        [attributes] =&gt; Array
                            (
                                [title] =&gt;
                            )

                    )

                [module] =&gt; menu
                [hidden] =&gt; 0
                [external] =&gt; 0
                [has_children] =&gt; 0
                [expanded] =&gt; 0
                [weight] =&gt; -49
                [depth] =&gt; 1
                [customized] =&gt; 1
                [p1] =&gt; 239
                [p2] =&gt; 0
                [p3] =&gt; 0
                [p4] =&gt; 0
                [p5] =&gt; 0
                [p6] =&gt; 0
                [p7] =&gt; 0
                [p8] =&gt; 0
                [p9] =&gt; 0
                [updated] =&gt; 0
                [load_functions] =&gt;
                [to_arg_functions] =&gt;
                [access_callback] =&gt; 1
                [access_arguments] =&gt; a:0:{}
                [page_callback] =&gt; _dew_auth_login_page
                [page_arguments] =&gt; a:0:{}
                [delivery_callback] =&gt;
                [tab_parent] =&gt;
                [tab_root] =&gt; student/login
                [title] =&gt; Student Login
                [title_callback] =&gt; t
                [title_arguments] =&gt;
                [theme_callback] =&gt;
                [theme_arguments] =&gt; a:0:{}
                [type] =&gt; 6
                [description] =&gt;
                [in_active_trail] =&gt;
                [href] =&gt; student/login
                [access] =&gt; 1
                [localized_options] =&gt; Array
                    (
                        [attributes] =&gt; Array
                            (
                                [title] =&gt;
                            )

                    )

            )

        [below] =&gt; Array
            (
            )

    )

)

*/

function i_dont_advise_this($menu_name) {
  $data = menu_tree_all_data($menu_name);
  $links = array();

  foreach($data as $MenuItem =&gt; $item) {
    $links []= l($item['link']['title'], $item['link']['link_path']);
  }
  return implode('|', $links);
}

print i_dont_advise_this('main-menu');
# yields =&gt;
# &lt;a href="/" class="active"&gt;Home&lt;/a&gt;|&lt;a href="/?q=student/login"&gt;Student Login&lt;/a&gt;