Created
February 10, 2017 20:33
-
-
Save mwordpress/9ad845f5f388f17221945986364b706a to your computer and use it in GitHub Desktop.
the codes listed here is part of the following article : https://www.mwordpress.net/how-to-display-related-posts-with-thumbnail-in-wordpress/
This file contains 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
<?php the_content(''); ?> | |
<?php include (TEMPLATEPATH . '/custom-related-posts.php'); ?> |
This file contains 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
<?php | |
/* | |
YARPP Template: Thumbnails | |
Description: Requires a theme which supports post thumbnails | |
Author: mitcho (Michael Yoshitaka Erlewine) | |
*/ | |
?> | |
<h2>مقالات ذات صلة</h2> | |
<?php if (have_posts()):?> | |
<ol> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php if (has_post_thumbnail()):?> | |
<li> | |
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> | |
<div class="thumbnail"> | |
<?php | |
if ( function_exists('show_thumb') ) { | |
show_thumb(300, 150, 'img-responsive', $post->ID, 100); | |
} else { | |
the_post_thumbnail(‘thumbnail’); | |
} | |
?> | |
</div> | |
<h3><?php the_title(); ?></h3> | |
</a> | |
</li> | |
<?php endif; ?> | |
<?php endwhile; ?> | |
</ol> | |
<?php else: ?> | |
<p>لا توجد مقالات ذات صلة</p> | |
<?php endif; ?> |
This file contains 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
/* | |
تنسيقات الاضافة : Yet Another Related Posts | |
يحب عليك تعديلها على حسب الشكل الذي تريد عرض المقالات به | |
*/ | |
.yarpp-related { | |
margin:0; | |
padding:2%; | |
width:96%; | |
} | |
.yarpp-related h2{ | |
} | |
.yarpp-related ol { | |
margin:0; | |
padding:0; | |
list-style:none; | |
width:100%; | |
} | |
.yarpp-related ol li{ | |
margin:0; | |
padding:0 0 0 1%; | |
width:24%; | |
} | |
.yarpp-related .thumbnail{ | |
} | |
.yarpp-related h3{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment