bbp_get_view_url

Return the view url.

Description

(string) bbp_get_view_url( (bool) $view = false ); 

Returns (string)

View url (or home url if the view was not found)

Parameters (1)

0. $view — Optional. (bool) => false
View id

Usage

  1. if ( !function_exists( 'bbp_get_view_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/template.php'; 
  3.  
  4. // Optional. View id 
  5. $view = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_view_url($view); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/common/template.php  
  1. function bbp_get_view_url( $view = false ) { 
  2. global $wp_rewrite; 
  3.  
  4. $view = bbp_get_view_id( $view ); 
  5. if ( empty( $view ) ) 
  6. return home_url(); 
  7.  
  8. // Pretty permalinks 
  9. if ( $wp_rewrite->using_permalinks() ) { 
  10. $url = $wp_rewrite->root . bbp_get_view_slug() . '/' . $view; 
  11. $url = home_url( user_trailingslashit( $url ) ); 
  12.  
  13. // Unpretty permalinks 
  14. } else { 
  15. $url = add_query_arg( array( bbp_get_view_rewrite_id() => $view ), home_url( '/' ) ); 
  16.  
  17. return apply_filters( 'bbp_get_view_link', $url, $view );