page-loader page-loader page-loader
web logo

" Bir yolun yalnız yolcusu… "

hızmetler
X : / Kod / WordPress /

2023-01-18


WordPress Custom Theme Index

 logo

WordPress Custom Theme Index

WordPress Custom Theme Index. Bu yazımızda wordpress custom tema yaparken index kısmında kullanılan kod listesi bulunmaktadır. Bu kodlar ile index kısmını yapabilirsiniz.

<?php  get_header();
/** template name: blog list */
?>

<content>
	<div class="content">

		<h1 class="c_text">
			Blog
		</h1>
		<hr class="space_2">
		<?php get_search_form(); ?>


		<div id="container" class="c_text">
			<!-- #################################### -->



        <?php
$the_query = new WP_Query( 
		array(
		'post_type'=> 'post',
		'post_status' => 'publish',
		'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1,
		)
	 );
if ( $the_query->have_posts() ) {
        while ( $the_query->have_posts() ) {
           $the_query->the_post();
                 ?>
					<span class="bloglistbox">
						<a href="<?php the_permalink() ?>">
							<?php if (has_post_thumbnail()): ?>
								<img src="<?php the_post_thumbnail_url() ?>" alt="logo">
							<?php endif ?>
						<h2><?php the_title(); ?></h2>
						<p class="times">
							<?php echo get_the_date(); ?>
						</p>
						</a>
					</span>
                 <?php
        }

		$num_posts = wp_count_posts('post')->publish;
		if ($num_posts > 5) {
			kriesi_pagination($the_query->max_num_pages);
		} 

    }else{
?>
<?php  _e("<h2>Arama sonuçları: ".get_query_var('s')."</h2>");?>
        <span class="blogbox">
            <div class="parg c_text">
				<h2>Hiçbirşey Bulunamadı!</h2>
                <p>Üzgünüz, henüz bir yazı yazılmamış.</p>
		    </div>
        </span>
<?php } ?>

		</div>

	</div>
</content>

<?php  get_footer();?>

WORDPRESS KONULARI


Okumak ilerlemenin bir parçasıdır.

– EW

YORUMLAR



Bir cevap yaz


E-posta hesabınız yayımlanmayacak. Gerekli alanlar işaretlendi *