Add CSS Class to a WordPress String

  • Unknown's avatar

    The below code adds Register/ Login/ Logout options to the WordPress main navigation menu.

    add_filter('wp_nav_menu_items','show_register_login_link');
    function show_register_login_link($nav) {
        // The "Register" link is not offered if the Administration > Settings > General > Membership: Anyone can register box is not checked.
        return $nav.wp_register("<li class='menu-item'>", "</li>", false)."<li class='menu-item'>".wp_loginout(get_site_url(), false)."</li>";
    }

    Can someone provide some insight on how I would go about adding a CSS class to the string in the above code? Then I would be able to float:right the string to show the Register/ Login/ Logout options to the far right of the WordPress main navigation. Thank you for your time I appreciate it.

  • Unknown's avatar

    Hi @bill66742, it looks like you are using WordPress but you are not hosted here at WordPress.com. For self-hosted WordPress sites such as yours, I would suggest asking for help from the theme author directly or ask in the volunteer-based WordPress.org Themes and Templates forum.

    For general questions on self-hosted WordPress.org installations, visit http://wordpress.org/support/.

    The differences between WordPress.com and WordPress.org.

  • The topic ‘Add CSS Class to a WordPress String’ is closed to new replies.