Hi.
I wrote this code.
add_filter(
// 画面のフックの取得
'hivepress/v1/forms/listing_buy',
function( $form ) {
// 出品時にエクストラの有無を取得
if (isset($form['fields']) == false) {
// エクストラが設定されていない場合、fieldsのボタンを追加
$form['fields'] = array_merge(
$form['button'],
[
'alert' => [
'caption' => 'いかなる理由のキャンセルであっても、決済手数料は購入者様負担となります。',
'type'=> 'checkbox',
'required' => true,
'_order' => 123,
],
]
);
} else {
// エクストラが設置されている場合、fieldsを追加
$form['fields'] = array_merge(
$form['fields'],
[
'alert' => [
'caption' => 'いかなる理由のキャンセルであっても、決済手数料は購入者様負担となります。',
'type'=> 'checkbox',
'required' => true,
'_order' => 123,
],
]
);
}
return $form;
},
1000
);
Then I could implement just like this.
But I want to change the checkbox to text only.
How do I do?
yevhen
August 30, 2023, 6:56pm
3
Please send more details that may help to detect or reproduce this issue (e.g. screenshots of how it works now and what you want to get as a result).
Sorry.
I’m excluding Japanese text.
I’ve written this code.
add_filter(
'hivepress/v1/forms/listing_buy',
function( $form ) {
if (isset($form['fields']) == false) {
$form['fields'] = array_merge(
$form['button'],
[
'alert' => [
'caption' => 'This is Checkbox',
'type'=> 'checkbox',
'required' => true,
'_order' => 123,
],
]
);
} else {
$form['fields'] = array_merge(
$form['fields'],
[
'alert' => [
'caption' => 'This is Checkbox',
'type'=> 'checkbox',
'required' => true,
'_order' => 123,
],
]
);
}
return $form;
},
1000
);
This code has roles that display a checkbox.
(The red one in the picture below.)
I want to change this checkbox to a non-checkbox, with only the text ‘This is a checkbox’
yevhen
August 31, 2023, 11:13am
6
Do you want to make this checkbox selected by default without the possibility of unchecking it, or do you want to show just a text instead of a checkbox? Is this checkbox the custom listing attribute, or have you added it with the code?
I want to show just a text instead of a checkbox.
In the original plan, Our implementation was checkbox.
But Plan is changed.
This checkbox is that I added with the code.
yevhen
September 4, 2023, 8:53am
9
Please try this PHP code snippet
add_filter(
'hivepress/v1/forms/listing_buy',
function($args){
$args['description'] = 'Custom text';
return $args;
},
1000
);
Thank you for your help.
I could become do it.
But I have Add question.
I want to change order to red arrow and blue arrow.
Description can’t add order.
Please teach me how do this.
yevhen
September 8, 2023, 4:23pm
12
The easiest way is to change the order of the two div tags, which are wrappers of these two sections with form description and form fields (it is possible to check the structure with the developer console in the browser) with CSS property order
order - CSS: Cascading Style Sheets | MDN
Other solutions require advanced customization.