那么如何在Jira IssueEventListener中获取自定义字段的先前值?我正在为issueUpdated(IssueEvent)事件编写自定义处理程序,如果某个自定义字段已更改,我想更改处理程序的行为.要检测更改类型,我想比较先前和当前值.
(我不是在问如何获得它的当前值 - 我知道如何从相关问题中获得它)
我正在开发针对Windows上的Jira 4.0.2.
扫描最近已知值的更改历史记录的最佳方法是什么?
List changes = changeHistoryManager.getChangeHistoriesForUser(issue, user);
Run Code Online (Sandbox Code Playgroud) 有谁知道在帖子编辑页面的标题输入字段正上方(或下方)添加输入字段(或与此类型的任何类型的html)的方法吗?
我正在寻找一种无需修改核心文件的方法(我将其作为创建自定义帖子类型的插件的一部分来进行)。
我不知道在edit-form-advanced.php文件的该区域中是否有任何可用的wp钩子可以帮助您。我真的希望有人提出了一个天才的解决方法!
目前我已经安装了Jreviews,我想用K2替换它来列出地址,电话,地图,营业时间......
使用K2我想我需要定义额外的自定义字段来保存这些特定信息.没问题.
但是,我如何配置要在特定商店的详细文章/项目中显示这些字段?
非常感谢,
提笔.
我正在尝试通过 wp_update_post 函数更新我的一篇帖子中的帖子内容。我已阅读此处的文档:http ://codex.wordpress.org/Function_Reference/wp_update_post
如果我做对了,我只需要发送帖子 ID 和我想要更新的帖子内容 - 就像示例中一样 - 这应该是唯一会改变的事情。尽管我附加到这篇文章的自定义字段消失了,但很奇怪。
我传递了以下代码:
if(isset($_POST['submit'])){
$the_post = array();
$the_post['ID'] = $_POST['id'];
$the_post['post_content'] = $_POST['recension'];
// Update the post into the database
wp_update_post( $the_post );
}
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种情况以及如何解决?
我有两种自定义的帖子类型,叫做艺术家和绘画.两种帖子类型都有一个名为艺术家名称的自定义字段,使用高级自定义字段插件创建.我需要能够将这两种帖子类型中的自定义字段相互匹配,以便显示更多信息.
仅在查询下方粘贴args和循环.如果有必要,将发布更多代码.
<?php
$artist_name = get_field('artist');
$args = array(
'post_type' => 'artists',
'meta_value' => $artist_name
);
$query_artist = new WP_Query( $args );
if ( $query_artist->have_posts() ) {
while ( $query_artist->have_posts() ) {
$query_artist->the_post(); ?>
<p class="artist-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<?php }
} else {
echo 'Artist not found';
}
wp_reset_postdata(); ?>
Run Code Online (Sandbox Code Playgroud)
此代码在主页的模板文件中正常工作,但在搜索结果页面中始终打印出"未找到艺术家".我直接从主页模板复制了这段代码,因此拼写错误不是问题.很长一段时间以来,我一直在打破这个局面.读这篇文章的人是否会知道发生了什么?
谢谢.
我一直在尝试在 woocommerce 后端添加一个自定义字段,用户可以在其中多选某个级别的复选框。
是否可以创建多个复选框?到目前为止,我有这个:
woocommerce_wp_checkbox(
array(
'id' => '_custom_product_niveau_field',
'type' => 'checkbox',
'label' => __('Niveau', 'woocommerce'),
'options' => array(
'MBO' => __( 'MBO', 'woocommerce' ),
'HBO' => __( 'HBO', 'woocommerce' ),
'WO' => __( 'WO', 'woocommerce' )
)
)
Run Code Online (Sandbox Code Playgroud)
但这不起作用...... woocommerce_wp_checkbox 是否支持这个?
我需要在 Shopify 产品页面上添加自定义文本框字段。
我的要求是在产品页面上添加文本框字段,当客户在购物车中添加产品时,该文本框字段值也会显示在购物车页面和结帐页面上。
我还需要在管理自定义订单页面上反映该文本框字段值。
这可能吗?
我使用PODS.io Wordpress插件为用户元创建了以下自定义字段:
我通过在我的主题中使用以下代码,在额外信息下将这些字段添加到WooCommerce结帐functions.php:
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {
woocommerce_form_field( 'date_of_birth', array(
'type' => 'text',
'class' => array('my-field-class form-row-wide'),
'label' => __('Date of Birth'),
'placeholder' => __('dd/mm/yyyy'),
), $checkout->get_value( 'date_of_birth' ));
woocommerce_form_field( 'emergency_contact_name', array(
'type' => 'text',
'class' => array('my-field-class form-row-wide'),
'label' => __('Emergency Contact Name'),
'placeholder' => __('contact name'),
), $checkout->get_value( 'emergency_contact_name' ));
woocommerce_form_field( 'relation', array(
'type' => 'text',
'class' => array('my-field-class form-row-wide'),
'label' => __('Emergency Relation'),
'placeholder' => …Run Code Online (Sandbox Code Playgroud) 在 Woocommerce 中,我尝试向我的产品添加一段自定义元,我想将其传递给订单。
我们有大量的产品,它们负责不同的成本中心,所以我需要产品管理中的一个选择框,我们可以选择将值传递到订单中的成本中心,这不需要由客户查看,但管理员需要在订单中以及每月的订单导出中查看以进行会计处理。
这是我到目前为止所拥有的,这将在产品编辑页面(管理员)中显示选择框:
// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
woocommerce_wp_select(
array(
'id' => '_select',
'label' => __( 'Cost Centre', 'woocommerce' ),
'options' => array(
'one' => __( 'MFEG', 'woocommerce' ),
'two' => __( 'YDIT', 'woocommerce' ),
)
)
);
echo '</div>';
}
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
function woo_add_custom_general_fields_save( $post_id ){
// Select
$woocommerce_select = $_POST['_select'];
if( !empty( $woocommerce_select ) )
update_post_meta( $post_id, '_select', …Run Code Online (Sandbox Code Playgroud) 我正在尝试在产品注释(WooComerce 3+)中添加“电话”字段。*也适用于未注册的用户(访客)。电话号码只能由管理员在管理面板中查看。
*电话字段需要设为“ 必填 ”。
我尝试使用此代码,但这不起作用:
function true_phone_number_field( $fields ) {
$fields['phone'] = '<p class="comment-form-phone"><label for="phone">Phone</label> <input id="phone" name="phone" type="text" value="" size="30" /></p>';
}
add_filter( 'comment_form_default_fields', 'true_phone_number_field');
Run Code Online (Sandbox Code Playgroud) custom-fields ×10
wordpress ×7
woocommerce ×4
php ×3
checkbox ×1
jira ×1
joomla-k2 ×1
orders ×1
review ×1
shopify ×1
while-loop ×1