Skip to content

Instantly share code, notes, and snippets.

@py7hon
Last active November 4, 2018 11:50
Show Gist options
  • Save py7hon/4cbcdab00f6284d8bcee7dbac287af63 to your computer and use it in GitHub Desktop.
Save py7hon/4cbcdab00f6284d8bcee7dbac287af63 to your computer and use it in GitHub Desktop.
Wordpress Last Release Like Horriblesubs
function relatedseries(){
foreach(array_slice((get_the_category()), 0, 1) as $cat){
$rlseries = new WP_Query(
array(
'post_type' => 'episode',
'name' => $cat->slug,
'posts_per_page'=> 1,
)
);
echo '<div class="latest-releases">';
while ( $rlseries->have_posts() ) : $rlseries->the_post();
echo '<ul>
<li class="active">
<a href="' .esc_url(get_permalink()). '"><span class="latest-releases-date">'.get_the_date( 'Y-m-d' );'</span>
' .get_the_title(). '
<div class="latest-releases-res">
';
$SD = get_post_meta($post->ID, 'SD', true);
$HD = get_post_meta($post->ID, '720p', true);
$SHD = get_post_meta($post->ID, '1080p', true);
echo '<span class="badge">'.$SD.'</span>';
echo '<span class="badge">'.$HD.'</span>';
echo '<span class="badge">'.$SHD.'</span>';
echo '</a>
</li>
</ul>
';
endwhile;
echo '</div>';
wp_reset_postdata();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment