Support » Plugin: Font Awesome 4 Menus » using html tags in menu item label text

  • Hi,

    Looks like this plugin might be a bit abandoned currently – thou its still working fine for me. All thanks to the author anyway.

    My site uses html tags in the menu item label text, as well as using font-awesome-for-menus plugin to display menu icons. (i need the html in order to force nicer word breaks at various responsive break points, but there are other uses.)

    For anyone looking, I found a solution to the fact that this plugin will break any such html constructs/hence menu item layout. (due to greedy regexp parsing). the fix is:

    file : /wp-content/plugins/font-awesome-for-menus/n9m-font-awesome-4.php
    line: (approx: 175)
    function: replace_item
    mod:

    ...
    // mod jrc 110819 - fix broken layout iff html in label text - regexp was too greedy for > char : 
    // orig: preg_match( '/(<a.+>)(.+)(<\/a>)/i', $item_output, $matches );
    preg_match( '/(<a.+?>)(.+)(<\/a>)/i', $item_output, $matches );
    / end mod jrc 110819: 
    ...

    hope this helps someone.

    • This topic was modified 1 year, 1 month ago by rcain.
  • The topic ‘using html tags in menu item label text’ is closed to new replies.