ThemeShaper Forums » Thematic

[closed]

a.sf-with-ul

(7 posts)
  • Started 11 years ago by helgatheviking
  • Latest reply from chris_s
  • This topic is not resolved
  1. happened across another theme today that was using superfish to help style its menu. and top-level links that had children under them got a special class a.sf-with-ul. This is exactly what I have been looking for. It even appears (as far as I can tell.. and that is not very far) to be part of the superfish code. So why don't we get that class in Thematic?

    Posted 11 years ago #
  2. Yes, that would be helpful so you could put an arrow icon for top level items that had a drop down. However, I think it has more to do with the WordPress function for wp_list_pages.

    I did a few searches and found some tutorials like this: http://www.svennerberg.com/2009/02/creating-a-submenu-in-wordpress/, but I didn't find the silver bullet.

    Posted 11 years ago #
  3. yes that is exactly what i want that class for. i wonder if WP will have that by default one day. thanks for the link... i'll check it out.

    Posted 11 years ago #
  4. Hi guys,

    There is an easy solution for this using the Superfish JS. By default thematic has the a.sf-with-ul functionality of the script turned off. It's easy enough to turn it back on

    First, filter the thematic_dropdown_options to link to a script from your child theme instead of the thematic dropdown options script like so:

    function child_sf_defaults($dropdown_options) {
    
    	$child_dropdown_options = str_replace('themes/thematic/library', 'themes/your-child-theme' , $dropdown_options);
    	return $child_dropdown_options;
    }
    add_filter('thematic_dropdown_options', 'child_sf_defaults');

    Then create a directory named scripts in your child theme. Now copy over the thematic-dropdowns.js from thematic>library>scripts>

    look for the line:
    autoArrows: false, // disable generation of arrow mark-up

    and change it to:
    autoArrows: true, // enable generation of arrow mark-up

    Unfortunately this fails if JS is disabled. Filtering wp_list_pages testing for pages with children and using regex to insert your class would be a better approach. Since it's all happening server-side the class would be there regrardless of js. Given some spare time I'll come back to it and put this together the right way for you.

    Sorry we didnt get this sooner.

    Posted 11 years ago #
  5. Gene,

    Wow that wasn't even that hard. doesn't superfish fail anyway if JS is disabled?

    I think the <span class="sf-sub-indicator"> is probably unnecessary, though it is easily CSSed away. Just getting that class on the link (a.sf-with-ul) would be enough.

    It would be awesome if you could get this server-side though. I'd give it a shot, but regex makes my eyes cross.

    I sort of think that should be default behavior, but maybe that is b/c I selfishly want to use it. :) I look forward to seeing your solution.

    Posted 11 years ago #
  6. Thanks for the insight Gene!

    Posted 11 years ago #
  7. I've been using this method when I need it, but I was just wondering if anyone found a server-side solution?

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.