Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show latest articles by the displayed user


  • jbboro3
    Participant

    @jbboro3

    I’ve this code in the custom function file.. It nicely display in the navigation..It shows in the page…./profile/articles .. Now what I want is to display by calling it somewhere in the custom page (within bp template) other than in the page …/profile/articles

    
    add_action ( 'my_profile_post', 'bpfr_get_post' );
    
    function bpfr_post_profile_setup_nav() {
    global $bp;
    
    	$parent_slug = 'articles';
    	$child_slug = 'posts_sub';	
    	$post_count = count_user_posts(  bp_displayed_user_id(), array('post', 'post' ) );
    
    		//Add nav item with posts count
    		bp_core_new_nav_item( array(
    			'name' => __( 'Articles' ) .'<span>'.$post_count.'</span>',
    			'slug' => $parent_slug,
    			'screen_function' => 'bpfr_profile_post_screen',
    			'position' => 40,
    			'default_subnav_slug' => $child_slug 
    		) );
    		
    		//Add subnav item 	 
    		bp_core_new_subnav_item( array( 
    			'name' => __( 'My latest posts' ),
    			'slug' => $child_slug, 
    			'parent_url' => $bp->loggedin_user->domain . $parent_slug.'/', 
    			'parent_slug' => $parent_slug, 
    			'screen_function' => 'bpfr_profile_post_screen'
    		) );
    
    	}
    
    	function bpfr_profile_post_screen() {	
    		add_action( 'bp_template_content', 'bpfr_profile_post_screen_content' );
    		bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    	}
    
    	function bpfr_profile_post_screen_content() {
    		do_action( 'my_profile_post' );
    	}
    
    add_action( 'bp_setup_nav', 'bpfr_post_profile_setup_nav' );

    Volunteered help will be highly appreciated.. Thanks

  • You must be logged in to reply to this topic.
Skip to toolbar