رفتن به مطلب

کمک برای ویرایش کد مطالب مرتبط بر اساس برچسب


پست های پیشنهاد شده

سلام وقت بخیر دوستان

کد صفحه single.php را براتون فرستادم لطفا بفرمایید برای مطالب مرتبط براساس برچسب باید چه کدی را جایگزین کد زیر کنم
ممنون و سپاس گزارم

<?php get_header();?>
<div class="fr">
<?php $banners_side1_r = get_option('tsweb_side1_r_ads_banners'); ?>
<section id="<?php if(!($banners_side1_r)) { echo"big-"; }?>single-main-content">
<?php if(have_posts()): while(have_posts()): the_post();?>
<article class="box">
<div class="box-title">
<span class="code-news">کد خبر : <?php the_id(); ?></span>
<span class="cats">دسته بندی : <?php the_category(', ');?></span>
<span class="date-meta">تاریخ انتشار : <?php the_time('Y/m/d'); ?> - <?php the_time('G:i'); ?></span>
</div>
<!--.box-title-->
<div class="box-content">
<div class="post">
<div id="sizecontroldiv" class="controlstyle"> اندازه فونت : + × </div>
<!--#sizecontroldiv-->
<!--<span id="print">چاپ خبر</span>-->
<div class="clear"></div>
<span class="roo-titr"><?php $toptitle = get_post_custom_values("toptitle"); echo $toptitle[0];?></span><!--.roo-titr-->
<h1 class="post-title">" style="<?php $post_meta = get_post_meta($post->ID, 'red',true); if (!empty($post_meta)) { ?>color: #ff0000;<?php } ?>"><?php the_title();?></h1>
<div class="post-content">
<?php the_content();?>
<?php
$banner_single = get_option('tsweb_ads_single_banner');
if($banner_single) {
$type_single = get_option('tsweb_ads_single_type');
if($type_single=="flash"){
?>
<div class="single-ads"><object width="468" height="60" type="application/x-shockwave-flash" data="<?php echo $banner_single; ?>"> <param value="<?php echo $banner_header; ?>" name="movie"><param value="transparent" name="wmode"></object></div>
<?php } else { ?>
"><img src="<?php echo $banner_single; ?>" alt="#" /><!-- max width:706px -->
<?php } } ?>
<div id="share">
<p>اشتراک این خبر در :</p>
<ul id="shareicon">
<li class="facebook">&t=<?php the_title(); ?>" title="facebook" target="_blank"> 
<li class="google-plus">" title="google-plus" target="_blank"> 
<li class="twitter">-<?php the_permalink(); ?>" title="twitter" target="_blank"> 

<!--#shareicon-->
</div>
<!--#share-->
</div>
<!--.post-content-->
</div>
<!--.post-->
</div>
<!--.box-content-->
<?php $attachments = new Attachments( 'attachments' ); /* pass the instance name */ ?>
<?php if( $attachments->exist() ) : ?>
<article id="gallery-wrapp">
<h3 class="box-title">گالری تصاویر خبر</h3>
<div class="gallery">
<?php $counter=1; while( $attachments->get() ) : ?>
<img src="<?php echo $attachments->src( 'full' ); ?>" data-full="<?php echo $attachments->src( 'full' ); ?>" alt="<?php echo $attachments->field( 'title' ); ?>">
<?php endwhile; ?>
</div>
</article>
<!--#gallery-wrapp-->
<?php endif; ?>
<?php if(get_option('tsweb_related')=='true') {
$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),
'showposts'=>get_option('tsweb_related_count'), // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '<article class="related-post"><h3 class="box-title">اخبار مرتبط</h3>';
?>
<?php
echo '

<?php
}
echo '

';
}
}
wp_reset_query(); ?>
</article>
<!--.related-post-->
<?php } if(get_option('tsweb_comment')=='true') { ?>
<article id="twosweb-comment"> <!-- You can start editing here. -->
<h3 class="box-title">نظرات کاربران</h3>
<?php comments_template('',true);?>
</article>
<!--#twosweb-comment-->
<?php } ?>
</article>
<!--.box-->
<?php endwhile; endif;?>
</section>
<!--#main-content-->
<?php $banners_side1_r = get_option('tsweb_side1_r_ads_banners'); if($banners_side1_r) { ?>
<?php get_sidebar('single'); } ?>
</div>
<!--.fr-->
<?php get_sidebar('two');?>
<div class="clear"></div>
<?php get_footer();?>

لینک به ارسال
  • 3 هفته بعد...
در در ۱۳۹۵/۹/۸ ه‍.ش. at 20:26، hajizadeh گفته است :

سلام وقت بخیر دوستان

کد صفحه single.php را براتون فرستادم لطفا بفرمایید برای مطالب مرتبط براساس برچسب باید چه کدی را جایگزین کد زیر کنم
ممنون و سپاس گزارم

<?php get_header();?>
<div class="fr">
<?php $banners_side1_r = get_option('tsweb_side1_r_ads_banners'); ?>
<section id="<?php if(!($banners_side1_r)) { echo"big-"; }?>single-main-content">
<?php if(have_posts()): while(have_posts()): the_post();?>
<article class="box">
<div class="box-title">
<span class="code-news">کد خبر : <?php the_id(); ?></span>
<span class="cats">دسته بندی : <?php the_category(', ');?></span>
<span class="date-meta">تاریخ انتشار : <?php the_time('Y/m/d'); ?> - <?php the_time('G:i'); ?></span>
</div>
<!--.box-title-->
<div class="box-content">
<div class="post">
<div id="sizecontroldiv" class="controlstyle"> اندازه فونت : + × </div>
<!--#sizecontroldiv-->
<!--<span id="print">چاپ خبر</span>-->
<div class="clear"></div>
<span class="roo-titr"><?php $toptitle = get_post_custom_values("toptitle"); echo $toptitle[0];?></span><!--.roo-titr-->
<h1 class="post-title">" style="<?php $post_meta = get_post_meta($post->ID, 'red',true); if (!empty($post_meta)) { ?>color: #ff0000;<?php } ?>"><?php the_title();?></h1>
<div class="post-content">
<?php the_content();?>
<?php
$banner_single = get_option('tsweb_ads_single_banner');
if($banner_single) {
$type_single = get_option('tsweb_ads_single_type');
if($type_single=="flash"){
?>
<div class="single-ads"><object width="468" height="60" type="application/x-shockwave-flash" data="<?php echo $banner_single; ?>"> <param value="<?php echo $banner_header; ?>" name="movie"><param value="transparent" name="wmode"></object></div>
<?php } else { ?>
"><img src="<?php echo $banner_single; ?>" alt="#" /><!-- max width:706px -->
<?php } } ?>
<div id="share">
<p>اشتراک این خبر در :</p>
<ul id="shareicon">
<li class="facebook">&t=<?php the_title(); ?>" title="facebook" target="_blank"> 
<li class="google-plus">" title="google-plus" target="_blank"> 
<li class="twitter">-<?php the_permalink(); ?>" title="twitter" target="_blank"> 

<!--#shareicon-->
</div>
<!--#share-->
</div>
<!--.post-content-->
</div>
<!--.post-->
</div>
<!--.box-content-->
<?php $attachments = new Attachments( 'attachments' ); /* pass the instance name */ ?>
<?php if( $attachments->exist() ) : ?>
<article id="gallery-wrapp">
<h3 class="box-title">گالری تصاویر خبر</h3>
<div class="gallery">
<?php $counter=1; while( $attachments->get() ) : ?>
<img src="<?php echo $attachments->src( 'full' ); ?>" data-full="<?php echo $attachments->src( 'full' ); ?>" alt="<?php echo $attachments->field( 'title' ); ?>">
<?php endwhile; ?>
</div>
</article>
<!--#gallery-wrapp-->
<?php endif; ?>
<?php if(get_option('tsweb_related')=='true') {
$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),
'showposts'=>get_option('tsweb_related_count'), // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '<article class="related-post"><h3 class="box-title">اخبار مرتبط</h3>';
?>
<?php
echo '

<?php
}
echo '

';
}
}
wp_reset_query(); ?>
</article>
<!--.related-post-->
<?php } if(get_option('tsweb_comment')=='true') { ?>
<article id="twosweb-comment"> <!-- You can start editing here. -->
<h3 class="box-title">نظرات کاربران</h3>
<?php comments_template('',true);?>
</article>
<!--#twosweb-comment-->
<?php } ?>
</article>
<!--.box-->
<?php endwhile; endif;?>
</section>
<!--#main-content-->
<?php $banners_side1_r = get_option('tsweb_side1_r_ads_banners'); if($banners_side1_r) { ?>
<?php get_sidebar('single'); } ?>
</div>
<!--.fr-->
<?php get_sidebar('two');?>
<div class="clear"></div>
<?php get_footer();?>

 

<?php
$tags = wp_get_post_tags($post->ID);
if ($tags) {
        $tag_ids = array();
        foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

        $args=array(
                'tag__in' => $tag_ids,
                'post__not_in' => array($post->ID),
                'showposts'=>5,
                'caller_get_posts'=>1
        );
        $my_query = new wp_query($args);
        if( $my_query->have_posts() ) {
                echo '<ul>';
                while ($my_query->have_posts()) {
                        $my_query->the_post();
                ?>
                        <li><a href="<?php the_permalink() ?>" rel="bookmark" title="پیوند دائمی به
<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
                <?php
                }
                echo '</ul>';
        }
}
  wp_reset_query();
?>
لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...