Pagination not work inside a buddypress profile tab

Community Forums Forums General Discussion Pagination not work inside a buddypress profile tab

This topic is: not resolved

This topic contains 1 reply, has 1 voice, and was last updated by  ggsalas 1 year, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #59032

    ggsalas
    Participant
    Post count: 8

    Hi, I like show posts in a buddypress profile tab: http://www.redminka.com/usuarios/gabriel/publicaciones/

    This is the code I use:

    	// NAV
    	// name, slug, screen, position, default subnav
    	
    	bp_core_new_nav_item( array( 
    	'name' => __( 'Publicaciones', 'buddypress'),
    	'slug' =>  'publicaciones' ,
    	//'screen_function' => 'funcion_tab_publicaciones', 
    	'position' => 40,
    	'default_subnav_slug' => 'todas',
    	) );
    	
    	// SUBNAV
    	// name, slug, parent_url, parent slug, screen function
    	bp_core_new_subnav_item( array( 
    	'name' => __( 'Todas', 'buddypress' ),  
    	'slug' => 'todas', 
    	'parent_url' => $bp->displayed_user->domain . 'publicaciones/' ,
    	'parent_slug' => 'publicaciones',
    	'screen_function' => 'funcion_tab_publicaciones' ) ); 
    	
    	bp_core_new_subnav_item( array( 
    	'name' => __( 'Borradores4', 'buddypress' ), 
    	'slug' => 'borradores', 
    	'parent_url' => $bp->displayed_user->domain . 'publicaciones/' ,
    	'parent_slug' => 'publicaciones',
    	'user_has_access' => ( bp_is_my_profile() || is_super_admin() ),
    	'screen_function' => 'funcion_tab_borradores' ) ); 
    }
    
    function funcion_tab_publicaciones() {
    	//add title and content here - last is to call the members plugin.php template
    	add_action( 'bp_template_content', 'funcion_tab_publicaciones_content' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function funcion_tab_publicaciones_content() {
    	global $post;
     	global $paged; // current paginated page
    	$curpage = $paged ? $paged : 1;
    
    	// arguments, adjust as needed
    	$args = array(
    		'post_type'      => 'post',
    		'posts_per_page' => 4,
    		'post_status'    => 'publish',
    		'author' => bp_displayed_user_id(),
    		'paged' => $paged
    	);
    	
    	global $wp_query;
    	$wp_query = new WP_Query( $args );
    
         do_action('genesis_loop');
         wp_reset_query();
    }
    add_action( 'bp_setup_nav', 'my_test_setup_nav' );

    My problem is that pagination give me a 404 error: http://www.redminka.com/usuarios/gabriel/publicaciones/page/2/

    Thanks

    http://www.redminka.com/usuarios/gabriel/publicaciones
    #59051

    ggsalas
    Participant
    Post count: 8

    I have found the probem, Is the first subtab:

    The URL of the tab is http://www.redminka.com/usuarios/gabriel/publicaciones/

    by default opens a subtab: “Todas”

    but without the real url: http://www.redminka.com/usuarios/gabriel/publicaciones/todas/

    The pagination works with the “real” URL: http://www.redminka.com/usuarios/gabriel/publicaciones/todas/page/2/

    How can resolve the “real” URL of the submenu tab of Buddypress?

    Thanka

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

You must be logged in to reply to this topic.