https://s27.postimg.org/niua66jqr/archive.jpg
我有我的表,因为它在右图中,但我不得不在archive.php
文件中添加一些代码。我没有修改任何存档表代码,只是添加了页眉和页脚。现在,它看起来像左边的图像。我可以更改style.css
文件中的某些内容(例如display:
?)或修改某些原始存档代码吗?
<div class="archive-container">
<h2><?php the_title(); ?></h2>
<script type="text/javascript">
var domainroot="sitetitle.com"
function Gsitesearch(curobj){
curobj.q.value="site:"+domainroot+" "+curobj.qfront.value
}
</script>
<form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)">
<p class="search">Search:<br />
<input name="q" type="hidden" class="texta" />
<input name="qfront" type="text" style="width: 186px; text-size: 12px; height: 14px;" /> </p>
</form>
<table id=arc>
<?php
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) as `month`, DAYOFMONTH(post_date) as `dayofmonth`, ID, post_name, post_title FROM $wpdb->posts WHERE post_type = 'article' AND post_status = 'publish' ORDER BY post_date DESC";
$key = md5($query);
$cache = wp_cache_get( 'mp_archives' , 'general');
if ( !isset( $cache[ $key ] ) ) {
$arcresults = $wpdb->get_results($query);
$cache[ $key ] = $arcresults;
wp_cache_add( 'mp_archives', $cache, 'general' );
} else {
$arcresults = $cache[ $key ];
}
if ($arcresults) {
$last_year = 0;
$last_month = 0;
foreach ( $arcresults as $arcresult ) {
$year = $arcresult->year;
$month = $arcresult->month;
if ($year != $last_year) {
$last_year = $year;
$last_month = 0;
?>
<tr class=year><th><br /><br /><?php echo $arcresult->year; ?></th></tr>
<?php
}
if ($month != $last_month) {
$last_month = $month;
?>
<tr class=archive><th><?php echo $wp_locale->get_month($arcresult->month); ?></th><td></td></tr>
<?php
}
?>
<tr class=archive>
<th><?php echo $arcresult->dayofmonth; ?></th>
<td id=p<?php echo $arcresult->ID; ?>>
<a href="/<?php echo $arcresult->post_name; ?>">
<?php echo strip_tags(apply_filters('the_title', $arcresult->post_title)); ?></a>
</td>
</tr>
<?php
}
}
?>
</table>
</div> <!-- /end .container -->