【发布时间】:2014-11-16 00:28:14
【问题描述】:
我希望你一切都好。 请, 我为 wordpress 安装了一个插件 woo-commerce。 当我创建产品时,我看不到产品的任何作者, 请问,如何为每个产品添加作者?
最好的问候
A.J.
【问题讨论】:
-
哇,非常好。非常感谢先生。
标签: wordpress
我希望你一切都好。 请, 我为 wordpress 安装了一个插件 woo-commerce。 当我创建产品时,我看不到产品的任何作者, 请问,如何为每个产品添加作者?
最好的问候
A.J.
【问题讨论】:
标签: wordpress
在 WordPress 中,每个帖子或自定义帖子(WooCommerce 产品)都有一个作者。如果您想在“产品”页面上显示产品作者,请将以下代码复制并粘贴到您的 functions.php 文件中。
add_filter('manage_posts_columns', 'wdm_columns_head');
add_action('manage_posts_custom_column', 'wdm_columns_content', 10, 2);
function wdm_columns_head($defaults) {
$defaults['Author'] = 'Author';
return $defaults;
}
function wdm_columns_content($column_name, $post_ID) {
if ($column_name == 'Author') {
$post_featured_image = get_the_author($post_ID);
if ($post_featured_image) {
echo $post_featured_image;
}
}
}
【讨论】: