Hi @lennydelmar
Thank you for the query. You can achieve this by overriding templates. Please follow the link, you will learn about template overriding –
https://directorist.com/documentation/directorist/developers-guide/template-override/
Then you can try overriding the following template from this path –
directorist/templates/archive/grid-view.php
I believe the above instructions will help you achieve what you seek.
Please inform me if you need further assistance.
Kind Regards
Thanks for your reply. I’ve read about overriding the template files and already use this feature. But keep asking for a code. Need to know how exactly I can pick up the link of website (from a custom field of listing card) and replace the permalink of listing. You guys do not have the option for a custom link for listings inside your plugin. But seriously should have! Thanks for any solutions in advance!
Hello
Please use the following codes to enable the ‘Field Key’ on the directory builder page –
add_filter('directorist_custom_field_meta_key_field_args', function ($args) {
$args['type'] = 'text';
return $args;
});
Then add the custom url field with a dedicated key like this –
https://prnt.sc/lUs7KRD1FoRw
Then use a child theme to override the following template –
Template location: /directorist/templates/archive/fields/listing_title.php
Code:
<?php
/**
* @author wpWax
* @since 6.6
* @version 7.0.4
*/
if (!defined('ABSPATH')) exit;
$custom_listing_link = get_post_meta(get_the_ID(), '_custom_listing_link', true);
?>
<h4 class="directorist-listing-title">
<?php
if ($custom_listing_link) :
echo '<a href="' . $custom_listing_link . '">' . get_the_title() . '</a>';
else :
echo wp_kses_post($listings->loop_get_title());
endif;
?>
</h4>
<?php if (!empty($data['show_tagline']) && !empty($listings->loop_get_tagline())) { ?>
<p class="directorist-listing-tagline"><?php echo wp_kses_post($listings->loop_get_tagline()); ?></p>
<?php } ?>
This should work fine.
Please let me know if you need further assistance.
Kind Regards
Thank you so much!
It was a bit difficult to find Directory Builder file, but finally I got it (‘class-multi-directory-manager.php‘). Then overriding listing-title.php and thumb-card.php as well I achieved the custom link option for listings.
Big thanks guys! I will highly recommend Directorist for all of my friends developers as a no 1 directory plugin! Looking forward to seeing updates with advanced and live tag filter option!