کد نمایش زمان آخرین بروزرسانی مطالب در وردپرس
برای نمایش زمان بروزرسانی یا آخرین زمان ارسال مطلب میتوانید از کدهای زیر استفاده کنید:
[codesyntax lang=”php” lines=”normal” container=”div”]
<?php
wp_reset_query();
$tmp_query = $wp_query;
query_posts("showposts=1"); ?>
<?php while (have_posts()) : the_post(); ?>
به روز شده: <?php the_time('l j F Y') ?>
<?php endwhile;
wp_reset_query();
$wp_query = $tmp_query;
?>
[/codesyntax]
و برای نمایش زمان گذشته از کد زیر استفاده نمایید:
[codesyntax lang=”php” container=”div”]
<?php
wp_reset_query();
$tmp_query = $wp_query;
query_posts("showposts=1"); ?>
<?php while (have_posts()) : the_post(); ?>
به روز رسانی شده در <?php echo human_time_diff( get_the_time('G'), current_time('timestamp') ) ; ?> پیش
<?php endwhile;
wp_reset_query();
$wp_query = $tmp_query;
?>
[/codesyntax]