php - WordPress帖子上传时间问题
问题描述
我在 wordpress 中做了一个分类作为名称(研究)。
当我上传任何研究报告时,它显示我发布上传时间有几个小时错误,就像我在上午 9 点上传帖子时显示的是上午 6 点。
为什么会发生这种情况,有人可以告诉我吗?
这是我的代码:
<?php
$x=1; $args = array( 'post_type' => 'research' , 'posts_per_page' => '-1', 'order' => 'DESC', 'orderby' => 'date',); $index_query = new WP_Query($args);
while ($index_query->have_posts()) : $index_query->the_post(); ?>
<div class="col-md-6">
<div class="res-det">
<div class="card">
<div class="card-header">
<a href="<?php echo get_field('research'); ?> "><img src="<?php echo the_post_thumbnail_url(); ?>"></a>
</div>
<div class="card-body">
<a href="<?php echo get_field('research'); ?>"><h3><?php echo the_title(); ?></h3></a>
<span>Published <?php echo get_the_date('F j, Y'); ?> </span>
<p><?php echo the_content(); ?></p>
</div>
</div>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
在函数文件中:
add_action('init', 'research');
function research()
{
$labels = array(
'name' => _x('research', 'post type general name'),
'singular_name' => _x('research', 'post type singular name'),
'add_new' => _x('Add New', 'research'),
'add_new_item' => __('Add New research'),
'edit_item' => __('Edit research'),
'new_item' => __('New research'),
'view_item' => __('View research'),
'search_items' => __('Search research'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','thumbnail','editor')
);
register_post_type('research', $args);
}
add_action('init', 'research_category', 0);
function research_category()
{
$labels = array(
'name' => _x('Category', 'taxonomy general name'),
'singular_name' => _x('Category', 'taxonomy singular name'),
'search_items' => __('Search Category'),
'all_items' => __('All Category'),
'parent_item' => __('Parent Category'),
'parent_item_colon' => __('Parent Category:'),
'edit_item' => __('Edit Category'),
'update_item' => __('Update Category'),
'add_new_item' => __('Add New Category'),
'new_item_name' => __('New Category'),
'menu_name' => __('Category'),
);
register_taxonomy('research_category', array('research'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => 'research_category'),
));
}
解决方案
推荐阅读
- c - do循环没有正确执行
- git - 在 git 中修复错误并将更改合并到以前版本和所有下一个版本的正确方法是什么?
- vega-lite - 使用画笔与选择(单击)不一致的选择过滤器行为
- html - 无法将 tr 高度设置为 100% 或将 TD 宽度设置为 100%
- javascript - Google 跟踪代码管理器:CSS 选择器仅用于 a 中的一段文本
- 元素
- javascript - 在 Photoshop 或 R 中将来自耦合显微镜/光谱学的图像和数据拼接成全景图
- c# - 我收到一条错误消息,提示 System.Data.SqlClient.SqlException:'必须声明标量变量“@Emp_Email”。'
- wireshark - 捕获/生成 QUIC 流量
- android - Kotlin - 如何在片段中使用 recyclerView?
- typescript - 打字稿:用其他类型的键定义类型