Last active
November 5, 2017 17:14
-
-
Save m-torin/1706352 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 | |
do_action( 'opensky_pre_if_have_posts' ); | |
$prev_month = ''; $prev_year = ''; | |
$paged = ( get_query_var('paged') )? get_query_var('paged') : 1; | |
query_posts( array( 'post_type'=> 'album', 'paged' => $paged, 'author' => get_current_user_id() ) ); | |
if (have_posts()) : | |
// Show albums only if the user is a coauthor of at least one | |
// if(is_coauthor_for_post(get_current_user_id(), get_the_ID())) : | |
$hasalbums = true; | |
echo ' <h2 class="page-title">'. $name . __('\'s Albums by Date', 'onephoto') .'</h2>'; | |
// Show user's albums | |
echo '<ul class="mt35 row">'; | |
do_action( 'opensky_pre_while_have_posts' ); | |
while (have_posts()) : | |
the_post(); | |
// Continue only if the user is a CoAuthor of the particular album | |
if(is_coauthor_for_post(get_current_user_id(), get_the_ID())) : | |
if(get_the_time('F') != $prev_month || get_the_time('Y') != $prev_year) | |
echo ( $prev_month != '' ? '</div>' : '' ) . '<div class="month-wrapper"><h2 class="archive-date">'.get_the_time('F Y'). '</h2>'; | |
// Grab the album N.R.Y. template | |
do_action( 'opensky_pre_get_nry_content' ); | |
get_template_part( 'content', 'pt-album' ); | |
do_action( 'opensky_post_get_nry_content' ); | |
$prev_month = get_the_time('F'); | |
$prev_year = get_the_time('Y'); | |
endif; | |
endwhile; | |
do_action( 'opensky_post_while_have_posts' ); | |
echo '</div></ul>'; | |
// Run pagination or next links | |
echo '<nav id="postfooternav">'; | |
echo '<p>' . posts_nav_link(' • ') . '</p>'; | |
echo '</nav>'; | |
/*****************************************/ | |
/* If user has 0 albums/photos show welcome | |
/***************************************** | |
else : | |
echo '<div style="margin-top: -20px; width:960px;">'; | |
get_template_part( 'script', 'newuser' ); | |
echo '</div>'; | |
endif; | |
*/ | |
// If no albums at all, we assume this is a fresh client site | |
else : | |
// If nothing is found, display the error page | |
get_template_part( 'script', 'newuser' ); | |
// Close everything up, were done here | |
endif; | |
do_action( 'opensky_post_if_have_posts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment