Skip to content

Commit

Permalink
Use make_clickable to format manufacturer address. Use attachment cap…
Browse files Browse the repository at this point in the history
…tion (if available) to output safety attachment html.
  • Loading branch information
dennisnissle committed Oct 28, 2024
1 parent e1dae57 commit 77da694
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions includes/abstracts/abstract-wc-gzd-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,12 @@ public function get_safety_attachment_filename( $id, $context = 'view' ) {
}

public function get_safety_attachment_title( $id, $context = 'view' ) {
if ( $file = $this->get_safety_attachment( $id, $context ) ) {
return get_the_title( $id );
if ( $this->get_safety_attachment( $id, $context ) ) {
if ( $caption = wp_get_attachment_caption( $id ) ) {
return $caption;
} else {
return get_the_title( $id );
}
}

return false;
Expand Down
1 change: 1 addition & 0 deletions includes/class-wc-gzd-manufacturer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ protected function format_address( $formatted_address ) {

// Add html breaks.
$formatted_address = implode( '<br/>', $formatted_address );
$formatted_address = make_clickable( $formatted_address );

return $formatted_address;
}
Expand Down

0 comments on commit 77da694

Please sign in to comment.