diff --git a/private/src/scripts/editor/blocks/menu/DisplayComponent.jsx b/private/src/scripts/editor/blocks/menu/DisplayComponent.jsx index 3127f3c5..09971a4e 100644 --- a/private/src/scripts/editor/blocks/menu/DisplayComponent.jsx +++ b/private/src/scripts/editor/blocks/menu/DisplayComponent.jsx @@ -141,6 +141,31 @@ class DisplayComponent extends Component { ); } + renderCustomMenu() { + const { attributes } = this.props; + const { color } = attributes; + + return ( + +
+ +
+
+ ); + } + render() { const { attributes, setAttributes } = this.props; @@ -162,6 +187,8 @@ class DisplayComponent extends Component { { label: __('Standard Menu', 'amnesty'), value: 'standard-menu' }, // translators: [admin] { label: __('In-page Menu', 'amnesty'), value: 'inpage-menu' }, + // translators: [admin] + { label: __('Custom Menu', 'amnesty'), value: 'custom-menu' }, ]} onChange={(option) => setAttributes({ type: option })} /> @@ -186,6 +213,7 @@ class DisplayComponent extends Component { {attributes.type === 'standard-menu' && this.renderStandardMenu()} {attributes.type === 'inpage-menu' && this.renderInPageMenu()} + {attributes.type === 'custom-menu' && this.renderCustomMenu()} ); } diff --git a/private/src/scripts/editor/blocks/menu/index.jsx b/private/src/scripts/editor/blocks/menu/index.jsx index 9ecd06b8..c6d7302d 100644 --- a/private/src/scripts/editor/blocks/menu/index.jsx +++ b/private/src/scripts/editor/blocks/menu/index.jsx @@ -25,6 +25,10 @@ registerBlockType('amnesty-core/block-menu', { type: 'string', default: 'standard-menu', }, + items: { + type: 'array', + default: [], + }, }, edit: DisplayComponent, diff --git a/private/src/styles/blocks/button/_all.scss b/private/src/styles/blocks/button/_all.scss index 1811e70e..2b8489d1 100755 --- a/private/src/styles/blocks/button/_all.scss +++ b/private/src/styles/blocks/button/_all.scss @@ -18,6 +18,7 @@ */ @import "./sizes"; @import "./fill"; +@import "./layout"; @import "./spacing"; /** diff --git a/private/src/styles/blocks/button/_layout.scss b/private/src/styles/blocks/button/_layout.scss new file mode 100644 index 00000000..de0e8d5f --- /dev/null +++ b/private/src/styles/blocks/button/_layout.scss @@ -0,0 +1,3 @@ +.wp-block-buttons.is-content-justification-start { + justify-content: start; +} diff --git a/private/src/styles/blocks/core-blocks/_cover.scss b/private/src/styles/blocks/core-blocks/_cover.scss index 64b59443..f03c6ffa 100644 --- a/private/src/styles/blocks/core-blocks/_cover.scss +++ b/private/src/styles/blocks/core-blocks/_cover.scss @@ -1,5 +1,18 @@ -.wp-block-cover .wp-block-cover__image-background img { - object-fit: cover; - width: 100%; - height: 100%; +.wp-block-cover { + min-height: unset; +} + +.wp-block-cover .wp-block-cover__image-background, +.wp-block-cover video.wp-block-cover__video-background, +.wp-block-cover-image .wp-block-cover__image-background, +.wp-block-cover-image video.wp-block-cover__video-background { + &[data-object-fit="cover"] { + object-fit: cover; + width: 100%; + height: 100%; + } + + &[data-object-fit="contain"] { + object-fit: contain; + } } diff --git a/private/src/styles/blocks/core-blocks/post/_main.scss b/private/src/styles/blocks/core-blocks/post/_main.scss index a86eb94c..be2c8a25 100644 --- a/private/src/styles/blocks/core-blocks/post/_main.scss +++ b/private/src/styles/blocks/core-blocks/post/_main.scss @@ -3,6 +3,10 @@ background: var(--wp--preset--color--white); } +.tax-location .wp-block-post { + min-height: unset; +} + .wp-block-post > .wp-block-group:not(.post--result) { display: flex; flex-direction: column; diff --git a/private/src/styles/blocks/postlist/_post.scss b/private/src/styles/blocks/postlist/_post.scss index 385cdc23..e1bf0d4d 100644 --- a/private/src/styles/blocks/postlist/_post.scss +++ b/private/src/styles/blocks/postlist/_post.scss @@ -8,6 +8,10 @@ } @include mq(medium-sm) { + .tax-location .post { + min-height: unset; + } + .tax-location .post+.post { margin-left: flexy-gutter(); } diff --git a/wp-content/themes/humanity-theme/includes/helpers/class-get-image-data.php b/wp-content/themes/humanity-theme/includes/helpers/class-get-image-data.php index 7c79c144..3f5bd427 100644 --- a/wp-content/themes/humanity-theme/includes/helpers/class-get-image-data.php +++ b/wp-content/themes/humanity-theme/includes/helpers/class-get-image-data.php @@ -60,8 +60,8 @@ public function id(): int { * @return string */ public function metadata( bool $include_caption = true, bool $include_credit = true, string $type = 'image' ): string { - $caption = $this->caption(); - $credit = $this->credit(); + $caption = apply_filters( 'amnesty_image_data_caption', $this->caption(), $this->image_id, $type, $this ); + $credit = apply_filters( 'amnesty_image_data_credit', $this->credit(), $this->image_id, $type, $this ); if ( ! $caption && ! $credit ) { return ''; diff --git a/wp-content/themes/humanity-theme/patterns/taxonomy-location-country-selection.php b/wp-content/themes/humanity-theme/patterns/taxonomy-location-country-selection.php new file mode 100644 index 00000000..b369193a --- /dev/null +++ b/wp-content/themes/humanity-theme/patterns/taxonomy-location-country-selection.php @@ -0,0 +1,53 @@ +term_id, $object->taxonomy ); + $countries = amnesty_get_locations_by_type( [ 'term' => $top_level ] ); + + $options = [ + amnesty_term_link( $top_level ) => $top_level->name, + ]; + + foreach ( $countries as $child ) { + $options[ amnesty_term_link( $child ) ] = $child->name; + } +} + +if ( ! count( $options ) && is_admin() ) { + $options['-'] = __( 'Region name', 'amnesty' ); + $options['~'] = __( 'Country within region', 'amnesty' ); +} + +$select_args = [ + /* translators: [front] Countries Locations Page */ + 'label' => _x( 'View other countries in', 'shown before region name', 'aitc' ), + 'show_label' => true, + 'options' => $options, + 'is_nav' => true, + 'type' => 'nav', +]; + +?> + + + +
+ +
+ + + +
+ +
+ diff --git a/wp-content/themes/humanity-theme/patterns/taxonomy-location-hero.php b/wp-content/themes/humanity-theme/patterns/taxonomy-location-hero.php new file mode 100644 index 00000000..8c5a8c80 --- /dev/null +++ b/wp-content/themes/humanity-theme/patterns/taxonomy-location-hero.php @@ -0,0 +1,33 @@ +term_id, 'image_id', true ) ); + +// if the term is a report with no image, grab its parent term image instead +if ( ! $image_id && 'report' === get_term_meta( $object?->term_id, 'type', true ) ) { + $image_id = absint( get_term_meta( get_term_parent( $object )?->term_id, 'image_id', true ) ); +} + +$hero_data = [ + 'title' => $object?->name, + 'content' => $object->labels?->archives ?? $object?->description, + 'imageID' => $image_id, + 'hideImageCaption' => false, +]; + +if ( is_a( $object, WP_Term::class ) ) { + $disclaimer = fn (): string => strval( amnesty_get_location_disclaimer( $object ) ); +} else { + $disclaimer = fn ( ?string $text ): ?string => $text; +} + +add_filter( 'amnesty_image_data_caption', $disclaimer ); +printf( '', wp_kses_data( wp_json_encode( $hero_data, JSON_UNESCAPED_UNICODE ) ) ); +remove_filter( 'amnesty_image_data_caption', $disclaimer ); diff --git a/wp-content/themes/humanity-theme/patterns/taxonomy-location-human-rights.php b/wp-content/themes/humanity-theme/patterns/taxonomy-location-human-rights.php new file mode 100644 index 00000000..da8eee41 --- /dev/null +++ b/wp-content/themes/humanity-theme/patterns/taxonomy-location-human-rights.php @@ -0,0 +1,66 @@ + + +
+
+
+
+

+ + + +

+ + + +

+
+ + + +
+
+

+ + + +
+
+
+
+
+
+
+
+ + 'overview', + /* translators: [front] Countries Locations Page */ + 'label' => __( 'Overview', 'aitc' ), + ], +]; + +if ( have_posts() ) { + $menu_options[] = [ + 'id' => 'news', + /* translators: [front] Countries Locations Page */ + 'label' => __( 'News', 'aitc' ), + ]; +} + +$template_type = get_term_meta( get_queried_object_id(), 'type', true ) ?: 'default'; +$menu_options = apply_filters( 'amnesty_location_template_menu_options', $menu_options, $template_type ); + +$block_attributes = [ + 'color' => 'dark', + 'type' => 'custom-menu', + 'items' => $menu_options, +]; + +do_action( 'amnesty_location_template_before_menu', $template_type ); + +?> + +
+ +
+ +
+ +
+ + $news_term->term_id, + 'q' . $location_tax_slug => get_queried_object()->slug, + ], + amnesty_search_url() +); + +$query_args = [ + 'queryId' => 1, + 'query' => [ + 'perPage' => 3, + 'pages' => 0, + 'offset' => 0, + 'postType' => 'post', + 'order' => 'desc', + 'orderBy' => 'date', + 'author' => '', + 'search' => '', + 'exclude' => [], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- required parameter for the block + 'sticky' => 'exclude', + 'inherit' => true, + 'taxQuery' => [ + 'location' => [ get_queried_object_id() ], + ], + ], +]; + +// admin area ignores some args +if ( is_admin() ) { + $query_args['query']['inherit'] = false; + $query_args['query']['taxQuery'] = [ + 'category' => [ get_term_by( 'slug', 'news', 'category' )?->term_id ], + ]; +} + +?> + +
+ +
+ +
+ +

+ +
+ + + +
+ +
+
+ + +
+ +
+ +
+ + + + +
+ + + diff --git a/wp-content/themes/humanity-theme/patterns/taxonomy-location-offices.php b/wp-content/themes/humanity-theme/patterns/taxonomy-location-offices.php new file mode 100644 index 00000000..547e130b --- /dev/null +++ b/wp-content/themes/humanity-theme/patterns/taxonomy-location-offices.php @@ -0,0 +1,215 @@ + + + +
+ +
+ +
+ + +
+ +

+ + + +
+ 0 ) : ?> + +

+ + + +

+ '; + } + + if ( $media_contact['email'] ) { + printf( '%1$s', esc_attr( $media_contact['email'] ) ); + } + + ?> +

+ +
+ +
+ + + + have_posts() || $is_office_contact ) : ?> + +
+ post->post_title ) ) : ?> + +

+ + + have_posts() ) : ?> + +
+ have_posts() ) : ?> + the_post(); + + $address = get_post_meta( get_the_ID(), 'address', true ); + $phone = get_post_meta( get_the_ID(), 'phone', true ); + $email = get_post_meta( get_the_ID(), 'email', true ); + $website = get_post_meta( get_the_ID(), 'website', true ); + + ?> + + +
+ +

+ + +
+ +
+ + +

+ + +

+ +
+ + + + +
+ +

+ + +

+ +
+ + + + +
+ +

+ + +

+ +
+ + + + +
+ +

+ + +

+ +
+ + + + +
+ + + +
+ + +
+ +
+ + + + +
+ + + + + +
+ + +

+ + + + + +
+ +

+ + + +

+ +
+ + +
+ + +
+ + +
+ +
+ +
+ diff --git a/wp-content/themes/humanity-theme/patterns/taxonomy-location-overview.php b/wp-content/themes/humanity-theme/patterns/taxonomy-location-overview.php new file mode 100644 index 00000000..f16adb26 --- /dev/null +++ b/wp-content/themes/humanity-theme/patterns/taxonomy-location-overview.php @@ -0,0 +1,46 @@ +term_id, 'type', true ); + +$report_link = '#'; +if ( is_a( $location_object, WP_Term::class ) ) { + $report_link = get_annual_report_link( $location_object ); +} + +do_action( 'amnesty_location_template_before_overview', $template_type ); + +?> + +
+ +
+ +

+ + + +

+ + + +
+ +
+ +
+ +
+ + + + + + +
+ + + + +
+ + +