Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Adding generated link after Group name


  • jabbajabba
    Participant

    @jabbajabba

    Could someone help me and tell me how can i add a generated link, right after group names on the groups single page ?

    Something like this

    
    <?php
     echo ">a href="http://site.com/(group-name)">click here</a>"
     ?>
    

    And also where to add it 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

  • danbp
    Participant

    @danbp

    Hi @jabbajabba,

    create first a child-theme and add this snippet into functions.php or bp-custom.php

    We are going to use one of the existing action hook in the group header template and add it a custom function.

    function jabbajabba() {
    	echo '<a href="#">click here</a>';
    }
    //add_action( 'bp_before_group_header_meta', 'jabbajabba' );
    //add_action( 'bp_group_header_actions', 'jabbajabba' );
    add_action( 'bp_group_header_meta', 'jabbajabba' );

    The snippet has 2 commented action, so you can choose the best place for your link button.

    Reference file is
    buddypress/bp-templates/bp-legacy/buddypress/groups/single/group-header.php


    jabbajabba
    Participant

    @jabbajabba

    Thank you very much @danbp for you fast response.
    I didn’t wrote my question clear enough :/

    What i want to do is create a url just like above, but with the current group name in it.

    Like this
    http://somesite.com/current_group_name


    danbp
    Participant

    @danbp

    Try this

    function jabbajabba() {
    	?>
    	<a href="<?php bp_group_permalink(); ?>"><?php bp_current_group_name(); ?></a>
    <?php
    }
    add_action( 'bp_group_header_meta', 'jabbajabba' );

    jabbajabba
    Participant

    @jabbajabba

    thanks you very much!
    it works now


    danbp
    Participant

    @danbp

    You’re welcome !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Adding generated link after Group name’ is closed to new replies.
Skip to toolbar