mgsisk / webcomic

Comic publishing power for the web. Turn your WordPress-powered site into a comic publishing platform with Webcomic.
http://wordpress.org/plugins/webcomic
GNU General Public License v2.0
110 stars 29 forks source link

Displaying the date of the next scheduled comic in a storyline/collection? #178

Closed ThomasDotCodes closed 10 years ago

ThomasDotCodes commented 10 years ago

What would be the best way to show the date of the next scheduled webcomic within a storyline/collection/global?

I could have sworn I read something about it in the documentation, tried it, and couldn't get it to work. Now I'm looking through the wiki/source/issues again and can't find it anywhere.

mgsisk commented 10 years ago

This might've been something that was in Webcomic 3 but was removed (I thought there was something for it myself, but I'm not finding anything). Working in storylines get's… very complicated, but here's how to grab the publish date for the next schedule webcomic:

<?php
global $wpdb;

$next_webcomic = $wpdb->get_var( "SELECT post_date from {$wpdb->posts} where post_status = 'future' and post_type = 'webcomic1' order by post_date asc limit 1" );

echo date( "F j, Y", strtotime( $next_webcomic ) );
?>

Just replace webcomic1 with the collection ID for the collection you want to get the date for, and replace F j, Y with the date format you actually want.

ThomasDotCodes commented 10 years ago

thanks. I had it working with a wp query, and it got complicated, so was wondering if there was a built in feature for it.

Maybe I'll do a fork once I'm happy with it. Awesome, awesome work by the way. Thanks so much for this project, I'm looking forward to getting into it more.