Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_test_setup_nav() {
- global $bp;
- // Change the order of menu items
- //$bp->bp_nav['messages']['position'] = 100;
- // Remove a menu item
- $bp->bp_nav['blogs'] = false;
- // Change name of menu item
- // $bp->bp_nav['groups']['name'] = ‘community’;
- // Menú PUBLICACIONES
- //name, slug, screen, position, default subnav
- bp_core_new_nav_item( array(
- 'name' => __( 'Publicaciones' ),
- 'slug' => 'publicaciones',
- 'screen_function' => 'funcion_tab_publicaciones',
- 'position' => 40,
- 'default_subnav_slug' => 'mis_publicaciones'
- ) );
- }
- /* Add the subnav items to the profile */
- // name, slug, parent_url, parent slug, screen function
- bp_core_new_subnav_item( array( 'name' => __( 'Home' ), 'slug' => 'mis_publicaciones', 'parent_url' => $bp->loggedin_user->domain, 'parent_slug' => 'mis_publicaciones', 'screen_function' => 'funcion_tab_publicaciones' ) );
- function funcion_tab_publicaciones() {
- //add title and content here - last is to call the members plugin.php template
- add_action( 'bp_template_title', 'funcion_tab_publicaciones_title' );
- 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_title() {echo 'Mis Publicaciones'; }
- function funcion_tab_publicaciones_content() {
- global $post;
- global $paged; // current paginated page
- // arguments, adjust as needed
- $args = array(
- 'post_type' => 'post',
- 'posts_per_page' => 4,
- 'post_status' => 'publish',
- 'paged' => get_query_var( 'paged' )
- );
- /*
- Overwrite $wp_query with our new query.
- The only reason we're doing this is so the pagination functions work,
- since they use $wp_query. If pagination wasn't an issue,
- use: https://gist.github.com/3218106
- */
- global $wp_query;
- $wp_query = new WP_Query( $args );
- if ( have_posts() ) :
- echo '<ul>';
- while ( have_posts() ) : the_post();
- echo '<li>' . get_the_title() . '</li>';
- endwhile;
- echo '</ul>';
- do_action( 'genesis_after_endwhile' );
- endif;
- wp_reset_query();
- }
- add_action( 'bp_setup_nav', 'my_test_setup_nav' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement