Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1242960

    Hi,

    I’m using buddypress. On the homepage, I would like to link a button to
    '. home_url() . '/community/' . $current_user->user_login . '


    What should I add here to link to this dynamic url?

    The following shortcode creates the correct link but does not really help. Or maybe the “Visit now” text in the shortcode can be styled to look exactly like Avia transparent button?

    //user url shortcode
    function myprofile_shortcode() {
    	global $current_user;
    	get_currentuserinfo(); 
    	$myprofileurl = '<a href="'. home_url() . '/community/' . $current_user->user_login . '">Visit now</a>';
    	return $myprofileurl;
    }
    add_shortcode('myprofileurl', 'myprofile_shortcode');

    Thank you,

    • This topic was modified 4 years, 9 months ago by dumdeldidum.
    #1243802

    Hi, kind follow up after 4 days. I’ve implemented a workaround but am still interested how I would do it using the button. Thanks

    #1244283

    Hi,

    Sorry for the delay. Yes, we should be able to apply the same button style to the anchor or link tag. Just add a unique id or class attribute to the link so that we can target it or add an external css style.

    $myprofileurl = '<a class="custom-visit-button" href="'. home_url() . '/community/' . $current_user->user_login . '">Visit now</a>';
    

    We can start with this css code.

    .custom-visit-button {
      background-color: red;
      color: white;
      border-radius: 3px;
      padding: 10px;
      font-size: 12px;
      text-decoration: none;
      display: inline-block;
      border-bottom-style: solid;
      border-bottom-width: 1px;
      margin: 3px 0;
      line-height: 1.2em;
      position: relative;
      font-weight: normal;
      text-align: center;
      padding: 15px 30px 13px;
      font-size: 13px;
      min-width: 139px;
      max-width: 100%;
    }

    Best regards,
    Ismael

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.