Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
open-source
hacklab-blocks
Commits
8c37b88d
Commit
8c37b88d
authored
2 years ago
by
Everaldo Matias
Browse files
Options
Download
Plain Diff
Merge branch 'develop' into main
parents
7d6e408a
34a51481
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
blocks/custom-taxonomy/custom-taxonomy.php
blocks/custom-taxonomy/custom-taxonomy.php
+7
-2
blocks/post-meta/post-meta.php
blocks/post-meta/post-meta.php
+3
-1
No files found.
blocks/custom-taxonomy/custom-taxonomy.php
View file @
8c37b88d
...
...
@@ -65,6 +65,9 @@ function render_block_core_post_terms_2($attributes, $content, $block)
$wrapper_attributes
=
get_block_wrapper_attributes
(
array
(
'class'
=>
$classes
));
$html_array
=
[];
$html
.
=
'<div class="hacklab-custom-taxonomy-block">'
;
foreach
(
$post_terms
as
$term
)
{
// The $term is an object, so we don't need to specify the $taxonomy.
$term_link
=
get_term_link
(
$term
);
...
...
@@ -85,10 +88,12 @@ function render_block_core_post_terms_2($attributes, $content, $block)
}
// We successfully got a link. Print it out.
$html_array
[]
=
'<a clas
e
s="'
.
$class
.
'" href="'
.
esc_url
(
$term_link
)
.
'">'
.
$term
->
name
.
'</a>'
;
$html_array
[]
=
'<a class="'
.
$class
.
'" href="'
.
esc_url
(
$term_link
)
.
'">'
.
$term
->
name
.
'</a>'
;
}
$html
=
implode
(
$separator
,
$html_array
);
$html
.
=
implode
(
$separator
,
$html_array
);
$html
.
=
'</div>'
;
}
return
$html
;
}
This diff is collapsed.
Click to expand it.
blocks/post-meta/post-meta.php
View file @
8c37b88d
...
...
@@ -23,7 +23,9 @@ function post_meta_callback($attributes, $content, $block)
return
''
;
}
$metadata
=
[];
$classes
=
''
;
foreach
(
$attributes
[
'selectedMeta'
]
as
$meta
)
{
$classes
.
=
' '
.
$meta
;
$metadata
[]
=
get_post_meta
(
$block
->
context
[
'postId'
],
$meta
,
true
);
}
$html
=
''
;
...
...
@@ -32,7 +34,7 @@ function post_meta_callback($attributes, $content, $block)
$separator
=
empty
(
$attributes
[
'separator'
])
?
' '
:
$attributes
[
'separator'
];
$html_array
=
[];
foreach
(
$metadata
as
$meta
)
{
$html_array
[]
=
$meta
;
$html_array
[]
=
'<div class="'
.
$classes
.
'">'
.
$meta
.
'</div>'
;
}
$html
.
=
implode
(
$separator
,
$html_array
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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