Yes, you can do this quite easily.
You could put this code into a plugin, and activate it using a shortcode in either copy, or a widget.
But I feel that a more natural arrangement would be to put it into your theme, make sure this is a child theme.
creating a child theme http://codex.ww.wp.xz.cn/Child_Themes
Where do you need this button on your page ? Add it to the relevant part of your theme.
Hi and thank you for the reply,
the problem is that I don’t have much experience with coding.
Could you write a code for me to put in the page template of the theme?
Thank you,
Luca
There are very likely things about this that won’t suit you, but it will be something like this:
<?php
if ( is_user_logged_in() ) {
$user = wp_get_current_user();
echo '<div class="userButton"><a href="http://someWebSite/~'. $user->user_login . '"><img src="aButton.jpg"></a></div>';
}
?>
Thank you very much RossMitchell for the fast reply.
Now I found a button code that I would like to modify:
<div class="col-sm-3 clientarea-button">
<a>" href="<?php echo $whmcs_url . 'dologin.php?email=' . $client_email . '×tamp=' . $timestamp . '&hash=' . $hash . '&goto=' . urlencode($whmcs_subfolder . 'clientarea.php'); ?>">
<span class="glyphicon glyphicon-globe"> </span>
<h4><?php echo __('My Website', 'woocommerce-whmcs'); ?></h4>
</a>
</div>
Could you please modify this code for me, so that it points to [username].wpbox.org/wp-admin, where [username] is the username of the logged in user.
I don’t need anything like if ( is_user_logged_in(), because only logged in users see this button.
Thank you very much,
Luca
There were some errors in the code too:
<div class="col-sm-3 clientarea-button">
<a href="http://siteName/~<?php echo wp_get_current_user()->user_login; ?>">
<span class="glyphicon glyphicon-globe"> </span>
<h4><?php echo __('My Website', 'woocommerce-whmcs'); ?></h4>
</a>
</div>
Thank you very very much! Works perfect!
One last favor. Could you please change the second line
so that it points to http://username.sitename.com/wp-admin instead of http://sitename/~username
Once more with feeling:
<div class="col-sm-3 clientarea-button">
<a href="http://<?php echo wp_get_current_user()->user_login; ?>.siteName.com/wp-admin">
<span class="glyphicon glyphicon-globe"> </span>
<h4><?php echo __('My Website', 'woocommerce-whmcs'); ?></h4>
</a>
</div>