Wordpress Eklentisiz Arşiv Sayfası Oluşturma
<php
/*
Template Name: Archives
*/
get_header();
do_atomic( 'before_content' );
?><div id="content"><?php
do_atomic( 'open_content' );
?><div class="hfeed"><div class="entry-content">
<h1 class="entry-title"><?php the_title(); ?></h1><ul><?php
$myposts=get_posts('numberposts=-1&orderby=post_date&order=DESC');
foreach($myposts as $post) :
$year = mysql2date('Y', $post->post_date);
if($year != $previous_year){
echo '<li style="list-style:none;"><b>'.$year.'</b>';
}
echo '<li style="list-style:disc;margin-left:3em;"><b>';
the_time('j F');
echo '</b>: <a href="';the_permalink();echo '">';
the_title();echo '</a></li>';
if($year != $previous_year){echo '</li>';}
$previous_year = $year;
endforeach;
?></ul></div></div><?php
do_atomic( 'close_content' ); // Close content hook
get_template_part( 'loop-nav' );
?></div><!-- #content --><?php do_atomic( 'after_content' );
get_footer(); ?>
Bu satırları ekledikten sonra , Wordpress'e giriş yapıp yeni bir sayfa ekliyoruz, sayfa şablonunu arşiv kodumuzunu yazdığımz sayfadan çağırıyoruz. Ve yayınlıyoruz. Artık sayfalarımızın kolaylıkla arşivlendiğini göreceksiniz.
Eğer şuan , eklenti ile sayfalama yapıyorsanız, güncelleyip eklentisiz arşiv kullanmanızı şiddetle öneriyorum.

Hiç yorum yok :
Yorum Gönder
Yorum eklenmiştir. Teşekkürler
Not: Yalnızca bu blogun üyesi yorum gönderebilir.