Last active
October 25, 2015 17:06
-
-
Save tarikcayir/7612be2e1be154ba2dc7 to your computer and use it in GitHub Desktop.
Question: http://sumostro.com/wordpressde-istedigim-ozelliklerde-kategori-listelemesini-nasil-yapabilirim Image: http://sumostro.com/wp-content/uploads/2015/10/wordpressde-istenilen-ozelliklerde-kategori-listelemesi.png
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.clear{ | |
clear: both; | |
} | |
.more-link{ | |
font-weight: bold; | |
} | |
.entry-category-list{ | |
margin-left: 80px; | |
width: 400px; | |
} | |
.entry-category-list ul{ | |
list-style-type: none; | |
} | |
.entry-category-list__item{ | |
border-bottom: 2px solid #ccc; | |
margin-bottom: 20px; | |
padding-bottom: 20px; | |
} | |
.entry-category-list__item--cover .entry-category-list__item-title{ | |
margin-top: 20px; | |
} | |
.entry-category-list__item-image{} | |
.entry-category-list__item-title{} | |
.entry-category-list__item-date{} | |
.entry-category-list__item-left{ | |
float: left; | |
width: 100px; | |
} | |
.entry-category-list__item-left .entry-category-list__item-image{ | |
height: 100px; | |
} | |
.entry-category-list__item-right{ | |
float: left; | |
padding-left: 20px; | |
width: 300px; | |
} | |
</style> | |
<div class="entry-category-list"> | |
<ul> | |
<?php | |
// Cateogry id | |
$args = array( 'cat' => 2 ); | |
// The Query | |
$the_query = new WP_Query( $args ); | |
$i = 1; | |
// The Loop | |
if ( $the_query->have_posts() ) { | |
while ( $the_query->have_posts() ): $the_query->the_post(); ?> | |
<?php if( $i == 1 ): ?> | |
<li class="entry-category-list__item entry-category-list__item--cover"> | |
<?php the_post_thumbnail( 'full', array( 'class' => 'entry-category-list__item-image' ) ); ?> | |
<h1 class="entry-category-list__item-title"> | |
<a href="<?php echo get_the_permalink(); ?>"><?php echo get_the_title(); ?></a> | |
</h1> | |
<div class="entry-category-list__item-content"><?php echo get_the_content('Daha fazla'); ?></div> | |
<time class="entry-category-list__item-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo get_the_date('j F, Y G:i'); ?></time> | |
</li> | |
<?php else: ?> | |
<li class="entry-category-list__item"> | |
<div class="entry-category-list__item-left"> | |
<?php the_post_thumbnail( 'full', array( 'class' => 'entry-category-list__item-image' ) ); ?> | |
</div> | |
<div class="entry-category-list__item-right"> | |
<h2 class="entry-category-list__item-title"> | |
<a href="<?php echo get_the_permalink(); ?>"><?php echo get_the_title(); ?></a> | |
</h2> | |
<time class="entry-category-list__item-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo get_the_date('j F, Y G:i'); ?></time> | |
</div> | |
<div class="clear"></div> | |
</li> | |
<?php endif; ?> | |
<?php $i++; ?> | |
<?php | |
endwhile; | |
} else { | |
echo 'Penguenler çok yalnız :( Yazı bulunamadı..' | |
} | |
/* Restore original Post Data */ | |
wp_reset_postdata(); | |
?> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment