Last active
August 29, 2015 14:01
-
-
Save AmeliaBriscoe/07d757d7e254a3178e63 to your computer and use it in GitHub Desktop.
Custom Loop displayed in category template used in conjunction with Premise Membership Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'genesis_loop', 'genesis_category_content' ); | |
| function genesis_category_content(){ | |
| if ( is_user_logged_in() ) { | |
| $category = get_category( get_query_var( 'cat' ) ); | |
| $args = array( | |
| 'cat' => $category->cat_ID, | |
| 'posts_per_page' => 12, | |
| 'paged' => get_query_var( 'paged' ), | |
| 'order' => 'ASC' | |
| ); | |
| global $wp_query; | |
| $wp_query = new WP_Query( $args ); | |
| echo '<div class="course-dashboard">'; | |
| echo '<div class="row clearfix">'; | |
| echo '<div class="first box long design-list">'; | |
| echo '<h4 class="widgettitle">'.$category->name.'</h4>'; | |
| echo '<ul>'; | |
| if( $wp_query->have_posts() ): | |
| while( $wp_query->have_posts() ): $wp_query->the_post(); global $post; | |
| $classes = 'one-fourth'; | |
| if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 4 ) | |
| $classes .= ' first'; | |
| echo '<li class="'. $classes . '">'; | |
| echo '<a href="'. get_permalink(). '" title="'.get_the_title().'" >'; | |
| echo get_the_post_thumbnail($post->ID, 'home-middle'); | |
| echo '</a>'; | |
| echo '<header class="entry-header">'; | |
| echo '<h2 class="entry-title">'; | |
| echo '<a href="'.get_permalink().'" title="'.get_the_title().'" >'.get_the_title().'</a>'; | |
| echo '</h2>'; | |
| echo '</header>'; | |
| echo '</li>'; | |
| endwhile; | |
| genesis_posts_nav(); | |
| endif; | |
| wp_reset_query(); | |
| echo '</ul>'; | |
| echo '</div>'; | |
| echo '</div>'; | |
| echo '</div>'; | |
| } | |
| if ( !is_user_logged_in() ) { | |
| echo do_shortcode(' | |
| [hide_from visible_to=\'public\'] | |
| <div id="nonmember-content"> | |
| <h3>Sorry, you must be a subscriber to see the rest of this content.</h3> | |
| <div class="left"> | |
| <h4>Already a Member?</h4> | |
| <a class="btn-login" href="http://member.ameliabriscoe.com/login/">Log In to Access the Library</a> | |
| </div> | |
| <div class="middle"><span class="icon-lock"></span></div> | |
| <div class="right"> | |
| <h4>Not a Member Yet?</h4> | |
| <a class="btn-login" href="http://member.ameliabriscoe.com/thesis-theme-video-training/">Get Your Premium Subscription Here</a> | |
| </div> | |
| <div class="clear"></div> | |
| </div> | |
| [/hide_from] | |
| '); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment