| Server IP : 206.188.193.52 / Your IP : 216.73.217.55 Web Server : Apache System : Linux prod-iad-vuxweb1501ae 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : 2670060.2931588 ( 1910161) PHP Version : 7.4.33 Disable Function : shell_exec,passthru,exec,system,pcntl_exec MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /data/20/2/18/60/2670060/user/2931588/htdocs/nsiwordpress/wp-content/themes/lightword/ |
Upload File : |
<?php
/*
Template Name: Blog archive
*/
?>
<?php get_header(); ?>
<div id="content-body">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php the_content(__('Continue reading','lightword'));?>
<?php
// echo archives start
$lastpost = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_date <'" . current_time('mysql') . "' AND post_status='publish' AND post_type='post' AND post_password='' ORDER BY post_date DESC LIMIT 1");
if(empty($output)){
$output = '';
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'hfy_archives_%'");
// Get all of the months that have posts
$monthquery = "SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM " . $wpdb->posts . " WHERE post_date <'" . current_time('mysql') . "' AND post_status='publish' AND post_type='post' AND post_password='' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC";
$monthresults = $wpdb->get_results($monthquery);
if ($monthresults) {
// Loop through each month
foreach ($monthresults as $monthresult) {
$thismonth = zeroise($monthresult->month, 2);
$thisyear = $monthresult->year;
// Get all of the posts for the current month
$postquery = "SELECT ID, post_date, post_title, comment_count FROM " . $wpdb->posts . " WHERE post_date LIKE '$thisyear-$thismonth-%' AND post_date AND post_status='publish' AND post_type='post' AND post_password='' ORDER BY post_date DESC";
$postresults = $wpdb->get_results($postquery);
if ($postresults) {
// The month year title things
$text = sprintf('%s %d', $month[zeroise($monthresult->month,2)], $monthresult->year);
$text_id = strtolower(str_replace(" ","",$text));
$postcount = count($postresults);
if($postcount=="1") $postcount_text = "post"; else $postcount_text = "posts";
$output .= "<h2 class=\"archive_h2\"><a onclick=\"jQuery('#$text_id').toggle();\">" . $text . "<span> (" . count($postresults) . " ".$postcount_text." )</span></a></h2>";
$output .= "<ul id='$text_id' class='hide'>\n";
foreach ($postresults as $postresult) {
if ($postresult->post_date != '0000-00-00 00:00:00') {
$url = get_permalink($postresult->ID);
$arc_title = $postresult->post_title;
if ($arc_title)
$text = wptexturize(strip_tags($arc_title));
else
$text = $postresult->ID;
$title_text = esc_html($text, 1);
$output .= ' <li>' . mysql2date('m/d', $postresult->post_date) . ': ' . "<a href='$url' title='$title_text'>$text</a>";
$output .= ' (' . $postresult->comment_count . ' ';
if($postresult->comment_count=="1") $output.= "comment"; else $output.= "comments";
$output .= ")</li>\n";
}
}
$output .= "</ul>\n\n";
}
}
update_option('hfy_archives_'.$lastpost,$output);
}else{
$output = '<strong>'. __('Not Found','lightword') .'</strong> '. __("Sorry, but you are looking for something that isn't here.","lightword") .'';
}
}
echo $output;
//echo archives end
?>
<?php endwhile; else: ?>
<h2><?php _e('Not Found','lightword'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","lightword"); ?></p>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>