Skip to content

Commit 6e7f815

Browse files
[#148] Adding ACF custom feild
1 parent 3aeb353 commit 6e7f815

File tree

3 files changed

+59
-4
lines changed

3 files changed

+59
-4
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"key": "group_672e7d812d248",
3+
"title": "Dialog Block",
4+
"fields": [
5+
{
6+
"key": "field_672e7d81d71ee",
7+
"label": "Button Text",
8+
"name": "button_text",
9+
"aria-label": "",
10+
"type": "text",
11+
"instructions": "",
12+
"required": 0,
13+
"conditional_logic": 0,
14+
"wrapper": {
15+
"width": "",
16+
"class": "",
17+
"id": ""
18+
},
19+
"default_value": "Open",
20+
"maxlength": "",
21+
"allow_in_bindings": 0,
22+
"placeholder": "",
23+
"prepend": "",
24+
"append": "",
25+
"show_in_graphql": 1,
26+
"graphql_description": "",
27+
"graphql_field_name": "buttonText",
28+
"graphql_non_null": 0
29+
}
30+
],
31+
"location": [
32+
[
33+
{
34+
"param": "block",
35+
"operator": "==",
36+
"value": "acf\/dialog"
37+
}
38+
]
39+
],
40+
"menu_order": 0,
41+
"position": "normal",
42+
"style": "default",
43+
"label_placement": "top",
44+
"instruction_placement": "label",
45+
"hide_on_screen": "",
46+
"active": true,
47+
"description": "",
48+
"show_in_rest": 0,
49+
"show_in_graphql": 1,
50+
"graphql_field_name": "dialogBlock",
51+
"map_graphql_types_from_location_rules": 0,
52+
"graphql_types": "",
53+
"modified": 1731100092
54+
}

wp-content/themes/wp-starter/blocks/dialog/render.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* @package WPStarter
88
*/
99

10-
$cbx_id = uniqid();
11-
10+
$cbx_id = uniqid();
11+
$button_text = get_field( 'button_text' );
1212
?>
1313
<?php if ( is_admin() ) : ?>
1414
<input type="checkbox" id="<?php echo esc_attr( $cbx_id ); ?>" class="acfbt-dialog-checkbox">
@@ -68,6 +68,6 @@ class="btn-default"
6868
@click="$refs.dialogRef.showModal(), openDialog = true"
6969
<?php endif; ?>
7070
>
71-
<?php esc_html_e( 'Open', 'wp-site-starter' ); ?>
71+
<?php esc_html_e( $button_text ? $button_text : 'Open', 'wp-site-starter' ); ?>
7272
</button>
7373
</div>

wp-content/themes/wp-starter/blocks/dialog/render.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#}
44

55
{% set cbx_id = 'dialog-' ~ random() %}
6+
{% set button_text = block.data['button_text'] %}
67

78
{% if function('is_admin') == true %}
89
<input type="checkbox" id="{{ cbx_id }}" class="acfbt-dialog-checkbox">
@@ -62,6 +63,6 @@
6263
@click="$refs.dialogRef.showModal(), openDialog = true"
6364
{% endif %}
6465
>
65-
Open
66+
{{ button_text ? button_text : 'Open' }}
6667
</button>
6768
</div>

0 commit comments

Comments
 (0)