14 | Posts |
Hi,
When you save your articles as drafts, they aren't hidden in the Archive gadget.
Even when you set a publish date in the future.
I had a look inside StaticGenerator.php and it looks like I could filter out the drafts in this section :
/**
* Regenerate the static content used to display the archive gadget
*
*/
static function GenArchiveGadget(){
global $addonPathData;
//get list of posts and times
$list = SimpleBlogCommon::AStrToArray( 'post_times' );
if( !count($list) ) return;
//get year counts
$archive = array();
foreach($list as $post_id => $time){
$ym = date('Y-m',$time); //year&month
$archive[$ym][] = $post_id;
}
The thing is that I would need to know which is a draft and which isn't so that I could do something like
if (!IsDraft) {
$archive[$ym][] = $post_id;
}
An uglier way would be to filter out every date in the future but the management of articles would become less user friendly.
Any advice?
Thanks!
1.5K | Posts |
65.1K | Downloads |
16 | Plugins |
You should be able to obtain the draft status using
$post_drafts = SimpleBlogCommon::AStrToArray('drafts');
and then filter it with
if( !isset($post_drafts[$post_id]) ){ $archive[$ym][] = $post_id; }
see Posts.php -> ShowPost() on GitHub
1.5K | Posts |
65.1K | Downloads |
16 | Plugins |
14 | Posts |
A new release for Typesetter is in the works with a lot of improvements including the ... Read More
Typesetter 5.1Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More
More News
What CMS: Find out what CMS a site is using.
Who Hosts This: Find out who is hosting any web site
WordPress Theme Detect: Find out which theme a WordPress site is using