Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
alain
Make it Open Project Site
Commits
5a6b5529
Commit
5a6b5529
authored
Apr 01, 2021
by
Benthe Kuijpers
Browse files
Improve submenu
parent
b74abd8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
wordpress/wp-content/themes/makeitopen/acf-json/group_605df11a2198d.json
deleted
100644 → 0
View file @
b74abd8f
{
"key"
:
"group_605df11a2198d"
,
"title"
:
"Submenu"
,
"fields"
:
[
{
"key"
:
"field_605df12f3fa42"
,
"label"
:
"Submenu items"
,
"name"
:
"submenu_items"
,
"type"
:
"repeater"
,
"instructions"
:
""
,
"required"
:
0
,
"conditional_logic"
:
0
,
"wrapper"
:
{
"width"
:
""
,
"class"
:
""
,
"id"
:
""
},
"collapsed"
:
""
,
"min"
:
0
,
"max"
:
0
,
"layout"
:
"table"
,
"button_label"
:
"Add submenu"
,
"sub_fields"
:
[
{
"key"
:
"field_605df1383fa43"
,
"label"
:
"Label"
,
"name"
:
"label"
,
"type"
:
"text"
,
"instructions"
:
""
,
"required"
:
0
,
"conditional_logic"
:
0
,
"wrapper"
:
{
"width"
:
""
,
"class"
:
""
,
"id"
:
""
},
"default_value"
:
""
,
"placeholder"
:
""
,
"prepend"
:
""
,
"append"
:
""
,
"maxlength"
:
""
},
{
"key"
:
"field_605df1590d65f"
,
"label"
:
"Anchor"
,
"name"
:
"anchor"
,
"type"
:
"text"
,
"instructions"
:
""
,
"required"
:
0
,
"conditional_logic"
:
0
,
"wrapper"
:
{
"width"
:
""
,
"class"
:
""
,
"id"
:
""
},
"default_value"
:
""
,
"placeholder"
:
""
,
"prepend"
:
""
,
"append"
:
""
,
"maxlength"
:
""
}
]
}
],
"location"
:
[
[
{
"param"
:
"post_type"
,
"operator"
:
"=="
,
"value"
:
"page"
}
]
],
"menu_order"
:
0
,
"position"
:
"normal"
,
"style"
:
"default"
,
"label_placement"
:
"top"
,
"instruction_placement"
:
"label"
,
"hide_on_screen"
:
""
,
"active"
:
true
,
"description"
:
""
,
"modified"
:
1616769374
}
\ No newline at end of file
wordpress/wp-content/themes/makeitopen/index.php
View file @
5a6b5529
...
...
@@ -5,10 +5,19 @@
<?php
if
(
have_posts
()
)
:
if
(
!
is_front_page
())
{
?>
<div
class=
"page-header
<?php
if
(
have_rows
(
'submenu_items'
))
{
echo
'page-header--submenu'
;
}
?>
"
>
if
(
!
is_front_page
())
{
$has_sub_menu
=
false
;
while
(
have_rows
(
'page_builder'
)
)
:
the_row
();
if
(
get_row_layout
()
==
'anchor'
)
{
$has_sub_menu
=
true
;
}
endwhile
;
?>
<div
class=
"page-header
<?php
if
(
$has_sub_menu
)
{
echo
'page-header--submenu'
;
}
?>
"
>
<h1>
<?php
echo
get_the_title
();
?>
</h1>
<?php
get_template_part
(
'template-parts/submenu'
);
?>
<?php
if
(
$has_sub_menu
)
{
get_template_part
(
'template-parts/submenu'
);
}
?>
</div>
<?php
}
...
...
wordpress/wp-content/themes/makeitopen/template-parts/page-builder-rows/anchor.php
View file @
5a6b5529
<div
id=
"
<?php
the_sub_field
(
'anchor'
);
?>
"
></div>
\ No newline at end of file
<?php
$anchor
=
strtolower
(
trim
(
preg_replace
(
'/[^A-Za-z0-9-]+/'
,
'-'
,
get_sub_field
(
'anchor'
))));
?>
<div
id=
"
<?php
echo
$anchor
;
?>
"
></div>
\ No newline at end of file
wordpress/wp-content/themes/makeitopen/template-parts/submenu.php
View file @
5a6b5529
<?php
if
(
have_rows
(
'submenu_items'
))
:
echo
'<div class="submenu">'
;
echo
'<div class="submenu__wrapper">'
;
while
(
have_rows
(
'submenu_items'
))
:
the_row
();
echo
'<a href="#'
.
get_sub_field
(
'anchor'
)
.
'" class="text-link text-link--down">'
.
get_sub_field
(
'label'
)
.
'</a>'
;
endwhile
;
echo
'</div>'
;
echo
'</div>'
;
endif
;
?>
\ No newline at end of file
<div
class=
"submenu"
>
<div
class=
"submenu__wrapper"
>
<?php
if
(
have_rows
(
'page_builder'
)
)
:
while
(
have_rows
(
'page_builder'
)
)
:
the_row
();
if
(
get_row_layout
()
==
'anchor'
)
:
$anchor
=
strtolower
(
trim
(
preg_replace
(
'/[^A-Za-z0-9-]+/'
,
'-'
,
get_sub_field
(
'anchor'
))));
echo
'<a href="#'
.
$anchor
.
'" class="text-link text-link--down">'
.
get_sub_field
(
'anchor'
)
.
'</a>'
;
endif
;
endwhile
;
endif
;
?>
</div>
</div>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment