Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@f444a32 from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Mar 20, 2024
1 parent b6cfd8f commit 3ce926c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions blocks/logo/src/edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ function LogoInner({ onLoad, className, width }) {
const svgLoad = (svg) => {
const svgEl = svg();

const [width, height] = svgEl.props.viewBox.split(' ').slice(2);
const [w, h] = svgEl.props.viewBox.split(' ').slice(2);

console.log('svgEl', svgEl, svgEl.props.viewBox, width, height);
console.log('svgEl', svgEl, svgEl.props.viewBox, w, h);

onLoad(width, height);
onLoad(w, h);
};

switch (selectedStyle[1]) {
Expand Down
12 changes: 10 additions & 2 deletions blocks/post-taxonomy-terms/post-taxonomy-terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ public function render_block_callback( $attributes, $content, $block ) {
)),
'style' => array_key_exists('separator', $attributes) ? '--separator: "' . $attributes['separator'] . '"' : null,
));

$post_terms = wp_get_post_terms( get_the_ID(), $taxonomy, array( 'number' => $per_page ) );
$post_id = get_the_ID();
$parent_id = wp_get_post_parent_id($post_id);
$post_terms = wp_get_post_terms( $post_id, $taxonomy, array( 'number' => $per_page ) );
// If this is a category taxonomy block we need to check if the only term being returned is "uncategorized" and if so, we need to return an empty array so that the block will look for the parent post's terms, if available.
if ( 'category' === $taxonomy && 1 === count($post_terms) && 'uncategorized' === $post_terms[0]->slug ) {
$post_terms = array();
}
if ( 0 !== $parent_id && empty($post_terms) ) {
$post_terms = wp_get_post_terms( $parent_id, $taxonomy, array( 'number' => $per_page ) );
}
$markup = '';
if ( !empty($post_terms) && !is_wp_error($post_terms) ) {
$markup .= '<ul class="wp-block-prc-block-post-taxonomy-terms__list">';
Expand Down

0 comments on commit 3ce926c

Please sign in to comment.