WordPress.org

Forums

Font Awesome Menus
Adding more than one word to the title field breaks the plugin (4 posts)

  1. ianarmstrong
    Member
    Posted 1 year ago #

    Code before adding the title attribute field:

    <a href="http://localhost/jennfaust/"><i class="icon-home"></i><span class="fontawesome-text"> Home</span></a>

    Code after adding "Return Home" to the title attribute field:

    <a title="Return <i class=" icon-home"=""><span class="fontawesome-text"> Home</span>" href="http://localhost/jennfaust/"><i class="icon-home"></i><span class="fontawesome-text"> Home</span></a>

    I haven't looked into debugging this yet but something isn't escaping/returning properly :)

    http://wordpress.org/plugins/font-awesome-menus/

  2. ianarmstrong
    Member
    Posted 1 year ago #

    Ah, yeah... looks like you aren't accounting for a link title in the replace function.

    function fontawesome_replace( $a ) {
            $listitem = $a[0];
            $icon = $a[2];
            $link_text = $a[3];
            $str_noicon = str_replace( $icon, '', $listitem );
            $str = str_replace( $link_text, '<i class="' . trim( $icon ) . '"></i><span class="fontawesome-text"> ' . $link_text . '</span>', $str_noicon );
            return $str;
        }
  3. niknaz
    Member
    Posted 1 year ago #

    I'm getting a similar output when using this plugin with a custom menu. I'm on WordPress 3.6, and I wonder if the wp_update_nav_menu_item() function in nav.menu.php is different and that's why the str_replace isn't working correctly. Any thoughts?

    I'm working locally, so I don't have a link to show, but what is happening is:

    -I create a new menu in Appearance>Menus
    -Populate it with a Link (let's say it's to Facebook) filling out the URL, Navigation Label, having it open in a new tab and filling in icon-facebook as the class. Everything else is blank.

    The output in the navigation is:
    facebook.com">F facebook
    (the F is the font awesome icon for Facebook)

    This is the HTML generated:
    <a target="_blank" href="http://www.<i class=" icon-facebook"=""><span class="fontawesome-text"> facebook</span>.com"><i class="icon-facebook"></i><span class="fontawesome-text"> facebook</span></a>

    I did some troubleshooting and got to the same code @ianarmstrong posted above.

    Any thoughts would be appreciated.

  4. DoodleDogCody
    Member
    Posted 1 year ago #

    Same thing happening here And not sure why. I have a menu full of social links. Two of the icons are created correctly and the rest are not. Here is the HTML that is created.

    <li id="menu-item-67">
      <a icon-youtube"="" href="http://www.<i class=" target="_blank">
        <span class="fontawesome-text"> youtube</span>
        .com">
        <i class="icon-youtube"></i>
        <span class="fontawesome-text"> youtube</span>
      </a>
    </li>
    <li id="menu-item-68">
      <a href="/feed" target="_blank">
        <i class="icon-rss"></i>
        <span class="fontawesome-text"> rss</span>
      </a>
    </li>

    I tried messing around with the link, the label, and the title, and target just to see what was causing the problem and couldn't come up with an answer

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Font Awesome Menus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic