Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erenkeskin/54aa8eab5fa6f32cca6c58203ade806b to your computer and use it in GitHub Desktop.
Save erenkeskin/54aa8eab5fa6f32cca6c58203ade806b to your computer and use it in GitHub Desktop.
<?php
$kategoriler = get_categories();
foreach ( $kategoriler as $kategori ) {
$degiskenler = array(
'cat' => $kategori->term_id,
'post_type' => 'post',
'posts_per_page' => '1',
'post__not_in' => $tekrar_etme
);
$query = new WP_Query( $degiskenler );
$kategori_linki = get_category_link($kategori->cat_ID);
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$tekrar_etme[] = $post->ID;
?>
<!-- Resim Kodumuz -->
<?php if ( has_post_thumbnail() ) { ?>
<?php the_post_thumbnail('thumbnail'); ?>
<?php } ?>
<!-- Kategori Adimiz -->
<?php echo $kategori->name; ?>
<!-- Kategori Linkimiz -->
<?php echo $kategori_linki; ?>
<?php
} // While dongusunun sonu
} // If blogunun sonu
wp_reset_postdata(); // Gonderileri Sifirliyoruz.
}
?>
/* Alt Taraf */
<?php
$cikartilacak_kategori_IDsi = 1;
$degiskenler = array(
'cat' => $kategori->term_id,
'post_type' => 'post',
'posts_per_page' => '1',
'post__not_in' => $tekrar_etme,
'category__not_in' => array($cikartilacak_kategori_IDsi)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment