Ask your WordPress questions! Pay money and get answers fast! (more info)

Menu Navigation Link That Can Pass PHP WordPress

  • SOLVED

Not sure if this is possible but here goes...

Is it possible to have a navigation link (say on the main nav bar) that can pass php??? Maybe a custom walker???

I have the following scenario;

I have custom meta fields that are updated by users on the Wordpress backend...

These fields are displayed on the front end in the author.php page... This works fine...

I have a menu link for the user to update their profile, however I would also like the user to have the ability to view their profile on the front end... I would like this to take the form of a menu link on the main nav bar, say "View Profile"...

So the menu link would need to point to say http://www.mydomain.com.au/?author=18 depending on the user...

The "Menu Link" would need to contain logic to say,

if the user is logged in
get their profile id
and take them to their author page, i.e
http://www.mydomain.com.au/?author=18

Any solution to this problem would be greatly appreciated...

Thanks,
Sean.

Answers (2)

2014-01-11

Just Me answers:

something like

global $current_user;
$current_user = wp_get_current_user();
$id = $current_user->ID;
if ($id > 0) {
echo "<a href=http://www.mydomain.com.au/?author=$id>View Profile</a>";
}


Sean Gartlan comments:

Yes ok that makes sense, however how do I integrate that concept into the menu structure within Wordpress??? See attached image...

Thanks,
Sean.