Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

halben on "Add custom register link to menu"

$
0
0

I'm trying to add a register link when the user is not logged in, it should display the register link in the top navigation.

I have the following:

if (is_admin() || $args -> theme_location != 'top_navigation')
		return $items;

	if (is_user_logged_in())
		$link = '<a href="' . wp_logout_url() . '" title="' . __('Logout') . '">' . __('Logout') . '</a>';
	else
		$link = '<a href="' . wp_login_url() . '" title="' . __('Login') . '">' . __('Login') . '</a>';

//This is where the new code would go.

	return $items .= '<li id="log-in-out-link" class="menu-item menu-type-link">' . $link . '</li>';

I only have the $link variable and if I add another variable, the code will break. Can someone please assist me?

Thanks,
Hal

[Bump deleted - http://codex.wordpress.org/Forum_Welcome#No_Bumping


Viewing all articles
Browse latest Browse all 8245

Trending Articles