Guest User

Untitled

a guest
May 5th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1.  
  2. <?php
  3. /**
  4.  * This file is used for listing the posts on profile
  5.  */
  6. ?>
  7.  
  8. <?php if ( buddyblog_user_has_posted() ): ?>
  9.     <?php
  10.     //let us build the post query
  11.     if ( bp_is_my_profile() || is_super_admin() ) {
  12.         $status = 'any';
  13.     } else {
  14.         $status = 'publish';
  15.     }
  16.  
  17.     $paged = bp_action_variable( 1 );
  18.     $paged = $paged ? $paged : 1;
  19.  
  20.     $query_args = array(
  21.         'author'        => bp_displayed_user_id(),
  22.         'post_type'     => buddyblog_get_posttype(),
  23.         'post_status'   => $status,
  24.         'paged'         => intval( $paged )
  25.     );
  26.     //do the query
  27.     $gp_query = new WP_Query( $query_args );
  28.     ?>
  29.  
  30.  
  31.     <?php if ( $gp_query->have_posts() ) : ?>
  32.  
  33.         <?php get_template_part( 'lib/sections/filter' ); ?>
  34.  
  35.         <div class="gp-inner-loop <?php echo sanitize_html_class( ghostpool_option( 'ajax' ) ); ?>">
  36.  
  37.             <?php if ( $GLOBALS['ghostpool_format'] == 'gp-blog-masonry' ) { ?><div class="gp-gutter-size"></div><?php } ?>
  38.  
  39.             <?php while ( $gp_query->have_posts() ) : $gp_query->the_post(); ?>
  40.  
  41.                 <?php get_template_part( 'post', 'loop' ); ?>
  42.  
  43.             <?php endwhile; ?>
  44.  
  45.         </div>
  46.  
  47.         <?php echo ghostpool_pagination( $gp_query->max_num_pages ); ?>
  48.  
  49.     <?php else : ?>
  50.  
  51.         <strong class="gp-no-items-found"><?php esc_html_e( 'No items found.', 'socialize' ); ?></strong>
  52.  
  53.     <?php endif; wp_reset_postdata(); ?>
  54.  
  55.     <?php
  56.     wp_reset_postdata();
  57.     wp_reset_query();
  58.     ?>
  59.  
  60. <?php elseif ( bp_is_my_profile() && buddyblog_user_can_post( get_current_user_id() ) ): ?>
  61.     <p> <?php _e( "You haven't posted anything yet.", 'buddyblog' );?> <a href="<?php echo buddyblog_get_new_url();?>"> <?php _e( 'New Post', 'buddyblog' );?></a></p>
  62.  
  63. <?php endif; ?>
Add Comment
Please, Sign In to add comment