سلام ضمن تشکر از همه دوستان مشکل حل شد کلا کد نیوسی این بخش related-posts.php عوض کردم
کد های فایل از اول نوشتم که دیگه نیازی هم به فایلfunctions.php و کلا تو هیمن فایلrelated-posts.php همه کارو بکنه
کد PHP:
<?php
$orig_post = $post;
global $post;
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> 10, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() ) {
echo '<div class="b_title"><h3>مطالب مشابه</h3></div>';
?>
<div class="b_block introfx b_4 clearfix">
<div id="block_carousel" class="carousel_posts_related owl-carousel">
<?PHP while( $my_query->have_posts() ) { $my_query->the_post();?>
<div class="item T_post">
<article <?php post_class(); ?>>
<div class="featured_thumb">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php if ( has_post_thumbnail() ): ?>
<?php the_post_thumbnail('carousel-block'); ?>
<?php format_icon(); ?>
<?php endif; ?>
</a>
</div>
<?php get_review(); ?>
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<div class="details">
<a class="date_c" href="<?php the_permalink(); ?>"><i class="icon-calendar mi"></i> <?php the_time('j F Y'); ?></a>
</div>
</article>
</div><?php } ?>
</div><!--/carousel-->
</div><!--/b block-->
<? } } $post = $orig_post;wp_reset_query(); ?>
مرسی از شما اقای T.Toosi