Advertisement
designbymerovingi

adjusted loop to use sell content add-on

Dec 3rd, 2014
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. // START
  2.  
  3.  
  4. <?php if ( have_rtmedia () ) { ?>
  5. <ul class="rtmedia-list rtmedia-list-media <?php echo rtmedia_media_gallery_class (); ?>">
  6.  
  7. <?php
  8.  
  9. // Edit by Gabriel - Start
  10. $show = false;
  11. $mycred = false;
  12. $user_id = get_current_user_id();
  13.  
  14. // Prevent crash if myCRED is disabled
  15. if ( class_exists( 'myCRED_Sell_Content_Module' ) ) {
  16. $mycred = new myCRED_Sell_Content_Module();
  17. }
  18.  
  19. // The Loop
  20. while ( have_rtmedia () ) : rtmedia ();
  21.  
  22. // If myCRED is enabled
  23. if ( $mycred !== false ) {
  24.  
  25. // If user is logged in and has paid, show the content
  26. if ( $user_id > 0 && $mycred->user_paid( $user_id, get_the_ID() ) )
  27. $show = true;
  28.  
  29. }
  30.  
  31. if ( $show )
  32. include ('media-gallery-item.php');
  33.  
  34. // You can replace this with anything you might want to show to a user who does not have access.
  35. else
  36. echo 'No access to this content.';
  37.  
  38. endwhile;
  39. // Edit by Gabriel - End
  40. ?>
  41.  
  42.  
  43. </ul>
  44.  
  45. <div class='rtmedia_next_prev row'>
  46. <!-- these links will be handled by backbone later
  47. -- get request parameters will be removed -->
  48. <?php
  49. // $display = '';
  50. // if ( rtmedia_offset () != 0 )
  51. // $display = 'style="display:block;"';
  52. // else
  53. // $display = 'style="display:none;"';
  54. ?>
  55. <!-- <a id="rtMedia-galary-prev" <?php //echo $display; ?> href="<?php //echo rtmedia_pagination_prev_link (); ?>"><?php //_e( 'Prev', 'rtmedia' ); ?></a>-->
  56.  
  57. <?php
  58. global $rtmedia;
  59. $general_options = $rtmedia->options;
  60. if( isset( $rtmedia->options['general_display_media'] ) && $general_options[ 'general_display_media' ] == 'pagination') {
  61. echo rtmedia_media_pagination();
  62. } else {
  63. $display = '';
  64. if ( rtmedia_offset () + rtmedia_per_page_media () < rtmedia_count () )
  65. $display = 'style="display:block;"';
  66. else
  67. $display = 'style="display:none;"';
  68. ?>
  69. <a id="rtMedia-galary-next" <?php echo $display; ?> href="<?php echo rtmedia_pagination_next_link (); ?>"><?php echo __( 'Load More', 'rtmedia' ); ?></a>
  70. <?php
  71. }
  72. ?>
  73.  
  74. // FINE IF START ELSE
  75.  
  76. </div>
  77. <?php } else { ?>
  78. <p class="rtmedia-no-media-found">
  79. <?php
  80. $message = __ ( "Oops !! There's no media found for the request !!", "rtmedia" );
  81. echo apply_filters('rtmedia_no_media_found_message_filter', $message);
  82. ?>
  83. </p>
  84. <?php } ?>
  85.  
  86. // END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement