رفتن به مطلب

ویرایش یک تکه کد مربوط به اطلاعات نویسنده


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

سلام دوستان

من یه تکه کد از صفحه singel.php کپی کردم همون کادری که مربوط به نمایش اطلاعات نویسندس

که کدش اینه!


<div class="author_box">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), '67' ); ?>
<div class="author_details">
<h5 class="author_name"><?php the_author_posts_link(); ?></h5>
<h5 class="author_title">
<?php
if(function_exists(icl_register_string)) {
icl_register_string('author', 'title', the_author_meta('title'));
echo icl_t('author', 'title', the_author_meta('title'));
} else {
echo get_the_author_meta('title');
}
?>
</h5>
<p>
<?php
if(function_exists(icl_register_string)) {
icl_register_string('author', 'description', the_author_meta('description'));
echo icl_t('author', 'description', the_author_meta('description'));
} else {
echo the_author_meta('description');
}
?>
</p>
</div> <!--Author Details-->
<div class="author_info">
<span class="num_of_entry"><?php _e('Number of Entries', 'theme'); ?> :
<?php
global $post;
$author_id=$post->post_author;
$post_author = $author_id; //author id
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $post_author AND post_type IN ('post') and post_status = 'publish'" );
echo $count;
?>
</span>
<div class="author_connect">
<?php if ( get_the_author_meta('linkedin')) { ?>
<a href="<?php echo get_the_author_meta('linkedin'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/linkedin.png" alt=""></a>
<?php } ?>
<?php if ( get_the_author_meta('facebook')) { ?>
<a href="<?php echo get_the_author_meta('facebook'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/facebook.png" alt=""></a>
<?php } ?>
<?php if ( get_the_author_meta('twitter')) { ?>
<a href="http://twitter.com/<?php echo get_the_author_meta('twitter'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/twitter.png" alt=""></a>
<?php } ?>
<?php if ( get_the_author_meta('gplus')) { ?>
<a href="<?php echo get_the_author_meta('gplus'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/gplus.png" alt=""></a>
<?php } ?>
</div>
</div> <!--Author Info-->
</div> <!--Author Box-->

حالا میخوام این کدها در صفحه ی author.php هم به نمایش دربیاد

خب طبیعتا برخی متغییر ها که تو کد هستند توی صفحه author.php غریبه هستند

متغییر هایی که باید تغییر کنند

در تصاویز زیر واضح

1

cdiv7zynga9oq8tssppe_thumb.png

2

ovtfkfdp82yuf75gt0b7_thumb.png

لینک به ارسال

<?php get_header(); ?>

<div class="inner">

<div class="container">

<div class="main">

<?php the_breadcrumb(); ?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php cat_article(); ?>

<?php endwhile; ?>

<?php else: ?>

<!-- Else in here -->

<?php endif; ?>

<?php mom_pagination(); ?>

<?php wp_reset_query(); ?>

</div> <!--End Main-->

<?php get_sidebar(); ?>

</div> <!--End Container-->

<?php get_footer(); ?>

لینک به ارسال

<?php get_header(); ?>
<div class="inner">
<div class="container">
<div class="main">
<?php the_breadcrumb(); ?>
<?php
$counter = 0;
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$counter++;
if($counter ==1):
?>

<div class="author_box">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), '67' ); ?>
<div class="author_details">
<h5 class="author_name"><?php the_author_posts_link(); ?></h5>
<h5 class="author_title">
<?php
if(function_exists(icl_register_string)) {
icl_register_string('author', 'title', the_author_meta('title'));
echo icl_t('author', 'title', the_author_meta('title'));
} else {
echo get_the_author_meta('title');
}
?>
</h5>
<p>
<?php
if(function_exists(icl_register_string)) {
icl_register_string('author', 'description', the_author_meta('description'));
echo icl_t('author', 'description', the_author_meta('description'));
} else {
echo the_author_meta('description');
}
?>
</p>
</div> <!--Author Details-->
<div class="author_info">
<span class="num_of_entry"><?php _e('Number of Entries', 'theme'); ?> :
<?php
global $post;
$author_id=$post->post_author;
$post_author = $author_id; //author id
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $post_author AND post_type IN ('post') and post_status = 'publish'" );
echo $count;
?>
</span>
<div class="author_connect">
<?php if ( get_the_author_meta('linkedin')) { ?>
<a href="<?php echo get_the_author_meta('linkedin'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/linkedin.png" alt=""></a>
<?php } ?>
<?php if ( get_the_author_meta('facebook')) { ?>
<a href="<?php echo get_the_author_meta('facebook'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/facebook.png" alt=""></a>
<?php } ?>
<?php if ( get_the_author_meta('twitter')) { ?>
<a href="http://twitter.com/<?php echo get_the_author_meta('twitter'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/twitter.png" alt=""></a>
<?php } ?>
<?php if ( get_the_author_meta('gplus')) { ?>
<a href="<?php echo get_the_author_meta('gplus'); ?>"><img src="<?php echo MOM_IMG; ?>/icons/gplus.png" alt=""></a>
<?php } ?>
</div>
</div> <!--Author Info-->
</div> <!--Author Box-->

<?php endif;?>

<?php cat_article(); ?>
<?php endwhile; ?>
<?php else: ?>
<!-- Else in here -->
<?php endif; ?>
<?php mom_pagination(); ?>
<?php wp_reset_query(); ?>
</div> <!--End Main-->
<?php get_sidebar(); ?>
</div> <!--End Container-->
<?php get_footer(); ?>

لینک به ارسال

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

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

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

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

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

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

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

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

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