How can I add a new social network beyond those supported natively to a listing?

Here is an example of doing so for Vkontakte (this code should be placed in your theme’s functions.php file):

add_filter('drts_social_medias', function($medias) {
    $medias['vkontakte'] = [
        'type' => 'textfield',
        'label' => 'VKontakte',
        'icon' => 'fab fa-vk',
        'default' => 'vkontakte',
        'placeholder' => 'Enter VKontakte username.',
    ];
    return $medias;
});
add_filter('drts_social_media_url', function($url, $name, $value) {
    if ($name === 'vkontakte') {
        $url = 'https://vk.com/' . $value;
    }
    return $url;
}, 10, 3);

How can I have a listing description use some default text if the description is empty?

  • You’ll want to use the Element Template feature of the plugin.
  • You would create a template file that looks something like this:
    <?php
    $post =  $entity->post();
    if ($post->post_content !== ”) {
    echo apply_filters(‘the_content’, $post->post_content);
    } else {
    echo ‘no description’;
    }
  • Save the file as directory__listing-element_listing_description.html.php in the wp-content/drts/assets/ directory.
  • Go to Directories –> [Your Directory] –> Content Types –> Listing –> Manage Displays –> Detailed and then click the green + icon to add a display element.
  • In the popup window click “Field Template” and select your template file saved previously.
  • Click “Add Element” and place the element where you wish the listing description/no description text to appear. (You can also delete the default Listing Description element)