Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Link to users blog.


Bowe
Participant

@bowromir

I think placing the following code at the bottom of functions.php of your child theme should do the trick:

`
/* Creates Blog navigation for Accordeon Menu */
function my_blog_menu(){
global $bp;
if ( !is_user_logged_in() || !function_exists(‘bp_blogs_install’) )
return false;
//two lines from bp_adminbar_blogs_menu() in bp-core-adminbar.php

if ( !$blogs = wp_cache_get( ‘bp_blogs_of_user_’ . $bp->loggedin_user->id . ‘_inc_hidden’, ‘bp’ ) ) {
$blogs = bp_blogs_get_blogs_for_user( $bp->loggedin_user->id, true );
wp_cache_set( ‘bp_blogs_of_user_’ . $bp->loggedin_user->id . ‘_inc_hidden’, $blogs, ‘bp’ );
}

if ( is_array( $blogs ) && (int)$blogs ) {

$blog=array_pop($blogs);//the first blog

?>
<a href="siteurl; ?>”>

`
After you’ve put this in your functions.php add the following to sidebar.php to call the function:

“`

Thanks to @sbrajesh for this snippet :)

Skip to toolbar