So I figured out how to show the pagination, with the following code. The problem is when I click on the next page, it brings me to a 404 page. But when I manually visit a custom URL it does show the second page correctly, here are both examples:
404 Version:
This is the url structure that is generated by this pagination code
www.website.com/members/username/my-videos/page/2/
Working Version:
This is a manual url I found to be working
www.website.com/members/username/my-videos/?page=2
Question is, how to get it to work with the first version (/page/2/)
CODE:
<?php function my_videos_screen_content() {
echo 'We are currently working on this section, some content may not appear properly. Thank you for your patience.'; ?>
<div class="container">
<div class="row">
<div class="col-sm-8">
<div class="row video-section meta-maxwidth-230">
<?php
$custom_query_args = array(
'post_type' => 'video',
'author' => bp_displayed_user_id(),
'posts_per_page' => get_option( 'posts_per_page' )
);
$custom_query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$custom_query = new WP_Query( $custom_query_args );
$temp_query = $wp_query;
$wp_query = NULL;
$wp_query = $custom_query;
if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post();
get_template_part( 'loop', 'video' );
endwhile; ?>
</div>
<?php endif;
wp_reset_postdata(); ?>
<?php // Custom query loop pagination
previous_posts_link( 'Newer Videos' );
next_posts_link( 'Older Videos', $custom_query->max_num_pages );?>
<?php // Reset main query object
$wp_query = NULL;
$wp_query = $temp_query; ?>
</div>
</div><!-- /.row -->
</div>
</div><!-- /.container -->