Skip to:
Content
Pages
Categories
Search
Top
Bottom

add ?id= at the topic urls


  • sasasasaaa
    Participant

    @sasasasaaa

    Hi, after long searching and trying and testing my last chance is to ask here.
    I have added a special forum with shortcode in a course page and want to give all topic links, which appear in the course forum, a “?id=” at the end of the urls (the ID is the course id).

    I use a customize breadcrumb. And if I have the course ID in the url of single topic page I can use it to show correct breadcrumb.

    Does anybody know how to add “?id=” at the end of the topic links on the forum pages?

    Help is very much appreciated.

    Thanks a lot

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

  • Robin W
    Moderator

    @robin-w

    may need some tinkering, but something like

    add_filter( 'bbp_get_topic_permalink', 'rew_add_forum_id', 10, 2) ;
    
    function rew_add_forum_id ($topic_permalink, $topic_id ) {
    	$forum = bbp_get_topic_forum_id( $topic_id) ;
    	if ($forum == '2925') {
    		//append ?id etc.
    		$topic_permalink.= '?id=2925' ;
    	}
    return $topic_permalink ;
    }

    sasasasaaa
    Participant

    @sasasasaaa

    You are my hero – it works perfectly fine! Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar