Skip to content

Commit

Permalink
Add new filter hook: directorist archive single listing url (#1699)
Browse files Browse the repository at this point in the history
add filter: directorist archive single listing url
  • Loading branch information
MahfuzulAlam authored Feb 12, 2024
1 parent 2f33da2 commit 02b6d8f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/model/Listings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ public function loop_get_published_date( $data ) {

public function loop_get_title() {
if ( ! $this->disable_single_listing ) {
$title = sprintf('<a href="%s"%s>%s</a>', $this->loop['permalink'], $this->loop_link_attr(), $this->loop['title']);
$title = sprintf('<a href="%s"%s>%s</a>', apply_filters( 'directorist_archive_single_listing_url', $this->loop['permalink'], $this->loop['id'], 'title' ), $this->loop_link_attr(), $this->loop['title']);
}
else {
$title = $this->loop['title'];
Expand Down
2 changes: 1 addition & 1 deletion templates/archive/fields/excerpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<p>
<?php echo esc_html( wp_trim_words( $value, (int) $data['words_limit'] ) );
if ( $data['show_readmore'] ) {
printf( '<a href="%s"> %s</a>', esc_url( $listings->loop['permalink'] ), esc_html( $data['show_readmore_text'] ) );
printf( '<a href="%s"> %s</a>', esc_url( apply_filters( 'directorist_archive_single_listing_url', $listings->loop['permalink'], $listings->loop['id'], 'excerpt' ) ), esc_html( $data['show_readmore_text'] ) );
}
?>
</p>
2 changes: 1 addition & 1 deletion templates/archive/fields/thumb-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
}


$link_start = '<a href="'.esc_url( $listings->loop['permalink'] ).'">';
$link_start = '<a href="'.esc_url( apply_filters( 'directorist_archive_single_listing_url', $listings->loop['permalink'], $listings->loop['id'], 'thumbnail' ) ).'">';
$link_end = '</a>';

if (!$listings->disable_single_listing) {
Expand Down

0 comments on commit 02b6d8f

Please sign in to comment.