Last active
August 29, 2015 14:01
-
-
Save tjtate/02261fdc68298d2520ff to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
public function content() { | |
global $af_theme, $post; | |
$subscribed = $af_theme->has_access( $this->pubcode ); | |
$new_label = ( $af_theme->is_new( get_the_date() ) ) ? '<span class="new">New</span>' : ''; | |
$this->pub = $pub = new WP_Query( array( 'post_type' => 'af_product', 'posts_per_page' => 1, 'meta_key' => 'pubcode', 'meta_value' => $this->pubcode ) ); | |
if( $pub->have_posts() ) : | |
while( $pub->have_posts() ) : $pub->the_post(); | |
// Stash for later | |
$this->pubname = get_the_title(); | |
$this->pubdescription = get_the_excerpt(); | |
endwhile; | |
endif; | |
wp_reset_query(); | |
?> | |
<!--Content Area--> | |
<div class="main-content large-12 columns"> | |
<div class="main-content-inner row"> | |
<div class="large-2 columns"> | |
<div class="meta-sidebar"> | |
<h6 class="title">Article Info</h6> | |
<div class="meta-item meta-date"> | |
<div class="meta-date-month"><?php the_time('M') ?></div> | |
<div class="meta-date-day"><?php the_time('j') ?></div> | |
<div class="meta-date-year"><?php the_time( 'Y' ) ?></div> | |
</div> | |
<?php | |
echo $af_theme->issue_alert_report_or_nada( $post ); | |
?> | |
<div class="meta-item meta-author"> | |
<div class="author-images-wrap" > | |
<?php | |
$authors = get_coauthors(); | |
foreach( $authors as $author ) { | |
echo get_avatar( $author->ID, 50 ); | |
} | |
?> | |
</div><br />By <?php coauthors_posts_links() ?> | |
</div> | |
<div class="meta-item meta-pub"> | |
Posted In <br /><a href="<?php echo site_url( '/pub/' . strtolower( $this->pubcode ) ) . '/' ?>"><?php echo $this->pubname ?></a> | |
</div> | |
</div> | |
</div> | |
<div class="large-10 columns"> | |
<div class="article-box"> | |
<div class="title"> | |
<?php echo $new_label ?> | |
<h1><?php the_title() ?></h1> | |
</div> | |
<div class="meta"> | |
<?php | |
if( $subscribed && $this->pubcode != '5MIN' ) { | |
echo sprintf('<a href="%s" class="meta-renewbtn button alert radius">Renew Now</a>', $this->renewal_url); | |
} | |
?> | |
<ul class="meta-list"> | |
<li class="meta-print"><span></span><a href="#">PRINT THIS PAGE<a/></li> | |
<li class="meta-resize"><span></span><a href="#">Resize Text</a></li> | |
<?php | |
if( get_post_meta( get_the_ID(), 'pdf_download', true ) ) { | |
?> | |
<li class="meta-pdf"><span></span><a href="<?php esc_url( get_post_meta( get_the_ID(), 'pdf_download', true ) ) ?>">Download The PDF</a></li> | |
<?php | |
} | |
?> | |
</li> | |
</ul> | |
</div> | |
<?php | |
$is_plus = get_post_meta( get_the_ID(), '_plus', true ); | |
$is_lifetime = get_post_meta( get_the_ID(), '_lifetime', true ); | |
$m = new WP_Query( array( 'posts_per_page' => 1, 'meta_key' => 'pubcode', 'meta_value' => $this->pubcode, 'post_type' => 'af_product' ) ); | |
while( $m->have_posts() ) : $m->the_post(); | |
$copy = get_post_meta( $m->post->ID, '_plus_paywall_copy', true ); | |
endwhile; | |
wp_reset_query(); | |
if( $subscribed ) { | |
if( $is_plus == 'yes' ) { | |
if( isset( $af_theme->subscriptions[$this->pubcode]['plus'] ) ) { | |
echo '<div class="article">'; | |
the_content(); | |
echo '</div>'; | |
} | |
else { | |
echo '<div class="article">'; | |
the_excerpt(); | |
echo '</div>'; | |
echo $af_theme->paywall( $this->pubcode, $this->pubname, $copy, true, true ); | |
} | |
} | |
else if ($is_lifetime == 'yes') { | |
if( isset( $af_theme->subscriptions[$this->pubcode]['lifetime'] ) ) { | |
echo '<div class="article">'; | |
the_content(); | |
echo '</div>'; | |
} | |
else { | |
echo '<div class="article">'; | |
the_excerpt(); | |
echo '</div>'; | |
echo $af_theme->paywall( $this->pubcode, $this->pubname, $copy, true, true ); | |
} | |
} | |
else { | |
echo '<div class="article">'; | |
the_content(); | |
echo '</div>'; | |
} | |
} | |
else { | |
if( $is_plus == 'yes' ) { | |
echo '<div class="article">'; | |
the_excerpt(); | |
echo '</div>'; | |
echo $af_theme->paywall( $this->pubcode, $this->pubname, $copy, true, true ); | |
} | |
else { | |
echo '<div class="article">'; | |
the_excerpt(); | |
echo '</div>'; | |
echo $af_theme->paywall( $this->pubcode, $this->pubname, $this->pubdescription ); #pubcode,pubname,description | |
} | |
} | |
?> | |
</div> | |
<?php | |
$tags = get_the_tags(); | |
$args = array( | |
'meta_query' => array( | |
array( | |
'key' => '_pubcode', | |
'value' => $this->pubcode, | |
'compare' => 'NOT IN' | |
) | |
), | |
'posts_per_page' => 3, | |
'post__not_in' => array( get_the_ID() ) | |
); | |
if( !$tags ) { | |
$args['category_name'] = 'report,issue,alert'; | |
} | |
else { | |
$tag_slugs = array(); | |
foreach( $tags as $t ) { | |
$tag_slugs[] = $t->slug; | |
} | |
$args['tax_query'] = array( | |
array( | |
'taxonomy' => 'post_tag', | |
'field' => 'slug', | |
'terms' => $tag_slugs, | |
'operator' => 'IN' | |
) | |
); | |
} | |
$loopz = new WP_Query( $args ); | |
echo sprintf( '<h4 class="sub-title">Other Readers of <strong>%s</strong> Also Benefit From these <strong>Articles</strong></h4>', $af_theme->all_subscriptions[strtoupper($this->pubcode)] ); | |
while( $loopz->have_posts() ) : $loopz->the_post(); | |
echo $af_theme->do_subscription_page_article( $loopz->post, $af_theme->all_subscriptions[strtoupper(get_post_meta( get_the_ID(), '_pubcode', true ))]); | |
endwhile; | |
wp_reset_query(); ?> | |
<a href="<?php echo site_url( '/pub/' . strtolower( $this->pubcode ) ) . '/' ?>" class="button radius browse-btn"><span>Browse All</span> <?php echo $this->pubname; ?> Articles</a> | |
<?php | |
if( $subscribed && $this->pubcode != '5MIN') { | |
echo sprintf('<a href="%s" class="footer-renew-btn button alert radius">Renew This Subscription</a>', $this->renewal_url ); | |
} | |
?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!--MAIN CONTENT END--> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment