Code

Support for Directories Pro plugin for WordPress

onokazu

onokazu supports this item

Supported

This author's response time can be up to 2 business days.

Popular questions for this item

Help, I have a blank page!

Please enable the debug mode of WordPress and see if any error message appears.

To enable the debug mode, change the following line in wp-config.php:

define('WP_DEBUG', false);

to

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
define('WP_DISABLE_FATAL_ERROR_HANDLER', true);

Make sure to add the lines to wp-config.php above where it says:

/* That's all, stop editing! Happy blogging. */

How can I create a landing page like that on your demo site?

The demo site uses the StoreFront theme and the landing page of the site is a WordPress page using the Homepage page template included with the theme.

The hero section of the landing page is where the content of the page is displayed by the Homepage template. We simply inserted the [drts-directory-search] shortcode as the page content to display a search form with some custom CSS rules for the transparent border around the form. Here is the exact shortcode syntax used:

[drts-directory-search directory="directory" size="lg" cache="1" style="padding:8px; background-color:rgba(0,0,0,0.15); border-radius:4px;"]

For more detail on the search form shortcode, please see Adding Search – Search form shortcode

Other sections of the landing page (photo slider, “Browse by Category”, “Popular Locations”, “Recent Listings”, “Recent Reviews” sections) are displayed using the Homepage Control plugin which is a free plugin that allows you to manage homepage components of Directories Pro. Your theme must be compatible with the Homepage Control plugin and unfortunately not many themes are compatible. For more details on Homepage Conrol and homepage components of Directories Pro, see Homepage Control.

If your theme is not compatible with Homepage Control, don’t worry. The homepage components of Directories Pro in Homepage Control are basically a wrapper to the [drts-directory-view] shortcode of Directories Pro. The [drts-directory-view] shortcode renders a view. A view is simply a set of criteria and configurations to query, sort, and display content items in various ways. You can create views and use the shortcode generated for each view to display the same content as homepage components of Homepage Control.

See Displaying Content with Views for more detail on views. In addition, take a look at the examples of custom views and step-by-step instructions on how to configure them.

I am getting a 404 (Page Not Found) error!

Please first try running the “Reload components” tool from Directories -> System -> Tools and also try re-saving the settings under Directories -> Settings -> Pages and see if that resolves the issue.

If the issue persists, please contact support with the URL to the page where we can actually see the issue. https://codecanyon.net/item/directories-pro-for-wordpress/21800540/support/contact

What’s different from your another directory plugin, Sabai Directory?

The primary difference between Directories Pro and Sabai Directory is that Directories Pro fully utilizes custom post types and taxonomies, and Sabai Directory does not. This allows Directories Pro to become more compatible with other WordPress plugins like WordPress SEO by Yoast and WPML.

In addition, there are more features with Directories Pro than with Sabai Directory, for example, improved directory management, views, live updating facet counts, display editor, etc.

Directories Pro was initially developed as Sabai Directory 2.0, however we decided to release it as a separate plugin since internally (code-wise) it is a completely different product.

What shortcodes are available?

There are several shortcodes available with the plugin.

[drts-directory-search] – Shows a search form for your directory. For more details on the search feature, see https://directoriespro.com/documentation/getting-started/adding-search.html

[drts-view] – Used to display a view, which is simply a set of criteria and configurations to query, sort, and display content items in various ways. For more details on views, see https://directoriespro.com/documentation/getting-started/displaying-content-with-views.html

[drts-directory-payment-pricing] – Shows a pricing table that displays payment plans along with their features that you have setup for your directory. For more details on payment plans and monetization, see https://directoriespro.com/documentation/monetization.html

[drts-entity] – Used to show the full/partial content or certain field values of a listing.

How can I add a custom social media account field to listings?

Below is a code example for TripAdvisor. You can add the code to functions.php of your theme.

add_filter('drts_social_medias', function($medias) {
    $medias['tripadvisor'] = [
        'type' => 'textfield',
        'label' => 'TripAdvisor',
        'icon' => 'fab fa-tripadvisor', // icon can be found in https://fontawesome.com/icons?d=gallery&s=brands
        'default' => 'tripadvisor',
        'placeholder' => 'Enter TripAdvisor username.',
    ];
    return $medias;
});
add_filter('drts_social_media_url', function($url, $name, $value) {
    if ($name === 'tripadvisor') {
        $url = 'https://www.tripadvisor.com/Profile/' . $value;
    }
    return $url;
}, 10, 3);

After adding the code, make sure to clear the cache from Directories -> System -> Tools. Then, enable TripAdvisor field by editing the Social Medias field from Directories -> [Your Directory] -> Content Types -> Listing -> Manage Fields.

Also we recommend adding the code to functions.php of a child theme and not to that of the original theme. If you add the code to functions.php of the original theme, you will lose the modifications when you update the theme. For details on child themes, see https://codex.wordpress.org/Child_Themes

How do I set a custom color for the search form submit button?

The [drts-directory-search] shortcode lets you choose from 8 color schemes (primary, secondary, success, warning, danger, info, dark, light) for the search form submit button which you can specify with the btn_color parameter. However if you wish to set a custom color other than those pre-defined, you will need to add the following CSS rules to your theme style.css. Make sure to change the background and border colors to your own color.

.drts-search-form .drts-search-form-submit,
.drts-search-form .drts-search-form-submit:hover,
.drts-search-form .drts-search-form-submit:not(:disabled):not(.drts-bs-disabled):active {
    background-color: #467fcf !important;
    border-color: #467fcf !important;
}

How can I change the default image that is displayed for listings without any photo?

You can add the following code to functions.php of your theme:

add_filter('drts_core_no_image_src', function($src) {
    $src = 'http://url_to_your_custom_image_file';
    return $src;
});

Make sure to replace http://url_to_your_custom_image_file in the code above with the URL of your custom image file.

In addition, in order to prevent the code from being deleted when you update your theme, we recommend creating a child theme of your current theme if you have not already done so and add the code to the child theme. For details on child themes, please see https://codex.wordpress.org/Child_Themes

If you also need to remove the small image icon overlay, you will need to add the following CSS to style.css of your theme:

.drts-display-element-with-background-no-image:before,
div.drts-no-image:before {
  display: none;
}

Is there a way to count and display the number of page views for each listing?

If you wish to show page view count for each listing in Directories Pro, you can install the Post Views Counter plugin or the WordPress Popular Posts plugin. After installing one of the plugins, clear the cache using the “Clear cache” tool in Directories -> System -> Tools.

You can then display the number of views for each post using the “Statistics” display element that you can add from Directories -> [Your Directory] -> Listing -> Content Types -> Listing -> Manage Displays.

Is it possible to display listings with a payment plan first?

You can do so by editing the view that is displaying listings from Directories -> [Your Directory] -> Content Types -> Listing -> Manage Views. Edit the view, and you will see the “Show items with a payment plan first” setting under the “Sort Settings” tab. You can then also select and set the sort order of payment plans from the “Payment plan sort order” setting.

Note that if you have also switched on the “Show featured items first” option under the same tab, featured listings will be displayed above paid listings so the order will be Featured listings -> Paid listings -> No payment plan listings.

How do I use custom images as category icons and to also show them as map markers?

As of version 1.2.23, you can use custom images as category icons.

1. Make sure that you have already created a custom “Image” type field from Directories -> [Your Directory] -> Content Types -> Category -> Manage Fields.

2. Go to Directories -> [Your Directory] -> Content Types -> Category -> Edit, scroll down to “Image Settings” and select your custom image field created in step 1 from the dropdown shown for the “Default icon field” setting.

3. To show category icons as map markers, edit the view used to show listings on the map from Directories -> [Your Directory] -> Content Types -> Listing -> Manage Views, and select “Show taxonomy icon – Category” for the “Map marker icon” setting under the “General” tab.

Note: You can do the same with tags. Simply replace “Category” with “Tag” in the steps above.

Is Advanced Custom Fields supported?

Yes, as of version 1.2.15 you can display fields created with the Advance Custom Fields plugin in the backend form as well as in the add listing/review form in the frontend.

In order to display fields in the frontend form, go to Directories -> [Your Directory] -> Content Types -> Listing (or Review) -> Manage Fields, click the green add element button and then click “ACF Fields” under the “Content” tab in the popup. Then select a field group from the list of ACF field groups in the “Field group” setting and click “Save Changes”.

In order to display ACF field values in Directories Pro displays, you can use the “Text” display element in the “Manage Displays” section of your directory (Directories -> [Your Directory] -> Content Types -> Listing (or Review) -> Manage Displays). The “Text” display element supports shortcodes so for example you can enter:

[acf field="your_acf_field_name" post_id="%id%"]

The “ id ” part above will automatically be replaced by the ID of the currently viewed listing (or review). Make sure to change “your_acf_field_name” with the actual field name configured in ACF.

For more details on displays in Directories Pro, please see https://directoriespro.com/documentation/getting-started/managing-and-customizing-displays.html

How can I modify user links in Directories Pro to link to BuddyPress profile?

You can use the drts_core_user_link_attr filter hook to modify attributes of user links generated by Directories Pro. You can add the following code to functions.php of your theme.

add_filter('drts_core_user_link_attr', function($attr, $identity) {
    if ($identity->id
        && function_exists('bp_core_get_user_domain')
        && ($url = bp_core_get_user_domain($identity->id))
    ) {
        unset($attr['target']);
        $attr['href'] = $url;
    }
    return $attr;
}, 10, 2);

Also we recommend adding the code to functions.php of a child theme and not to that of the original theme. If you add the code to functions.php of the original theme, you will lose the modifications when you update the theme. For details on child themes, see https://codex.wordpress.org/Child_Themes

I am getting an error “Failed fetching timezone for XX.XXXX,YY.YYYY” when trying to set a location for a listing.

The cause of the error depends on the Time zone API you have selected for your site under Directories -> Settings -> Map -> General Settings.

- Google Maps Time Zone

Make sure that you have created a server API key for Google Maps API as instructed in the documentation (https://directoriespro.com/documentation/getting-started/installation.html#obtaining-a-google-maps-api-key) and have entered the API key to Directories -> Settings -> Map -> General Settings -> GOOGLE MAPS API SETTINGS (SERVER) -> API key.

If you have enabled the “Application restrictions” option when you created the server API key from Google API Console, make also sure that you have selected the “IP addresses” option and NOT the “HTTP referrers (web sites)” option which is for browser API keys only.

- GeoNames Web Service Timezone

Make sure first that you have created a user account at GeoNames website (http://www.geonames.org/login) and have enabled their free web services from their user account page. Then on your site, go to Directories -> Settings -> Map -> General Settings -> GEONAMES WEB SERVICE SETTINGS -> “GeoNames user name” in the backend and make sure your GeoNames user account name is entered correctly.

My directory does not need locations.

If you simply do not wish to use the Location taxonomy, you can simply leave the Locations section of your directory empty.

If you wish to not only disable the Location taxonomy but also the default Location field, you can do so by switching off the “Enable locations” option under Directories -> [Your Directory] -> Settings.

On the single listing page, I would like to display blog posts submitted by the listing author.

You will first need to install a 3rd party plugin that lets you display user posts using a shortcode. One of the plugins that we recommend is the “Display Posts” plugin (https://wordpress.org/plugins/display-posts-shortcode/).

After installing and activating the Display Posts plugin, please go to Directories -> [Your Directory] -> Content Types -> Listing -> Manage Displays -> Detailed and add a “Text” display element and then enter the following shortcode to the “Text content” section:

[display-posts author_id="%author_id%"]

This will display blog posts submitted on your site by the listing author. For the full list of parameters available with the shortcode, please see their documentation here: https://displayposts.com/docs/parameters/

How can I change the URL to which users are redirected after login/registration?

You can add the following code to functions.php of your theme. Make sure to change the URL_to_your_page part to your custom page URL.

add_filter('drts_frontendsubmit_after_login_register_url', function($url) {
    $url = 'http://URL_to_your_page';
    return $url;
});

Also we recommend adding the code to functions.php of a child theme and not to that of the original theme. If you add the code to functions.php of the original theme, you will lose the modifications when you update the theme. For details on child themes, see https://codex.wordpress.org/Child_Themes

How can I change the URL to which users are redirected after successful listing submission?

You can add the following code to functions.php of your theme. Make sure to change the URL_to_your_page part to your custom page URL.

add_filter('drts_frontendsubmit_add_entity_success_url', function ($url, $entity) {
    if ($entity->getBundleType() === 'directory__listing') {
        $url = 'http://URL_to_your_page';
    }
    return $url;
}, 10, 2);

Also note that this works only when your directory does not have the payment feature enabled or submitting as a guest user without checkout. This is because when the payment feature is enabled, the user is always redirected to the WooCommerce checkout page.

In addition, we recommend adding the code to functions.php of a child theme and not to that of the original theme. If you add the code to functions.php of the original theme, you will lose the modifications when you update the theme. For details on child themes, see https://codex.wordpress.org/Child_Themes

We have a listing that belongs to multiple categories but only one of them is displayed on the listing page. The same is happening to locations, tags, and photos.

If your directory has payment features enabled, and the listing does not belong to any payment plan, you will need to configure the “Max number of categories allowed” setting (or locations/tags/photos) from Directories -> [Your Directory] -> Content Types -> Listing -> Edit -> Payment. If the listing does have a payment plan associated, then you will need to edit the same setting for the payment plan from the Products section of WooCommerce.

I would like to remove the author from all listings in my directory.

In order to remove the author from all existing listings in your directory, you can issue the following SQL against your database:

UPDATE wp_posts SET post_author = 0 WHERE post_type = 'xxx_dir_ltg';

Where xxx is the machine name of your directory. You can check the machine name of your directory from the “Directories” page in the backend. The string in parenthesis with lower case characters is the machine name of your directory, for example directory.

In addition, if your database is using a custom database table prefix, make sure to change the wp_ part of the wp_posts table name in the SQL to your custom database table prefix.

How can I change the image dimension for thumbnails generated by Directories Pro?

Directories Pro uses the following code to register the image dimension for cropped thumbnails:
add_image_size('drts_thumbnail', 240, 180, true);
and the following for scaled version of thumbnails:
add_image_size('drts_thumbnail_scaled', 240, 180, false);
You can simply override them by adding the following code to functions.php of your theme (child theme) for example (320×240 px):
add_action('init', function() {
    add_image_size('drts_thumbnail', 320, 240, true);
    add_image_size('drts_thumbnail_scaled', 320, 240);
}); 

For medium/large sized images, you can configure them from Settings -> Media.

Make sure to regenerate thumbnails after making the changes, using a 3rd plugin such as the Regenerate Thumbnails plugin.

How can I allow claiming a listing that already has an author assigned?

Please follow these steps:

1. Go to Directories -> [Your Directory] -> Content Types -> Listing -> Manage Fields and create a new “ON/OFF” type field.

2. Configure the field as shown in the screenshot below. You can change the labels but make sure the field name is set to “field_claimable” for the code in the next step to work properly.

3. Add the following code to functions.php of your theme:

add_filter('drts_claiming_is_entity_claimable', function($result, $entity) {
    if (!empty($entity->field_claimable[0])) {
        $result = true;
    }
    return $result;
}, 10, 2);

That’s all you need to do. Listings can now be claimed by other users even when an author is already assigned, if the field created in step 1 is checked. You (as admin or listing author) can check/uncheck the field when you add/edit listings.

In addition, if you wish to automatically uncheck the field for a listing when a claim for the listing is approved, you can add the following code to functions.php of your theme:

add_action('drts_claiming_claim_approved', function($claim, $claimedEntity) {
    drts()->Entity_Save($claimedEntity, ['field_claimable' => false]);
}, 10, 2);

In addition, we recommend adding the code to functions.php of a child theme and not to that of the original theme. If you add the code to functions.php of the original theme, you will lose the modifications when you update the theme. For details on child themes, see https://codex.wordpress.org/Child_Themes

How can I display bookmarked listings/reviews only on a separate page, including bookmarks by guest users?

You can add a new view from Directories -> [Your Directory] -> Content Types -> Listing (or Review) -> Manage Views. In the view configuration form, switch on the “Show bookmarked items only” setting under the “Query Settings” tab. You can then use the [drts-directory-view] shortcode generated for the view on a new WordPress page.

You can see how it works on our demo site:
- Bookmarked listings: https://demo.directoriespro.com/bookmarks/
- Bookmarked reviews: https://demo.directoriespro.com/bookmarked-reviews/

For more details on views, please see https://directoriespro.com/documentation/getting-started/displaying-content-with-views.html

How can I remove the related posts section added by Jetpack on single listing/review pages?

You can add the following code to functions.php of your theme:

add_filter('jetpack_relatedposts_filter_options', function ($options) {
    if (is_singular('xxx_dir_ltg')) $options['enabled'] = false;
    return $options;
});

Where xxx_dir_ltg is the content type (or post type) name for listings in your directory. You can check the content type name of your directory from Directories -> [Your Directory] -> Content Types in the backend.

How to add lightbox effect to photos and images?

First, go to Directories -> [Your Directory] -> Content Types -> Listing -> Manage Displays -> Detailed and edit the display element that shows photos or images, for example the default “Photos” display element. Select “Gallery” for the “Field renderer” setting and save the display element. This tells Directories Pro to use the WordPress [gallery] shortcode to display photos and images.

Then install the Responsive Lightbox & Gallery plugin which turns the [gallery] shortcode into a nice gallery with lightbox effect. Configure the plugin to customize the look of the gallery displayed.

My taxonomy term (category/location/tag) pages are not displaying listings at all.

This is most likely an issue caused by a conflict with the theme that you are currently using. Please try adding one or more of the following lines of code to functions.php of your theme and see if this resolves the issue.

add_filter('drts_wordpress_archive_force_singular', '__return_true');
add_filter('drts_wordpress_archive_force_is_page', '__return_true');
add_filter('drts_wordpress_archive_force_is_not_archive', '__return_true');

Is FontAwesome Pro supported?

Yes, in order to use the FontAwesome Pro version, download the latest icon package from https://fontawesome.com/ and upload fontawesome.min.css and the webfonts folder (and all its font files inside) to wp-content/drts/assets as shown below.

wp-content/
  drts/
    assets/
      fontawesome.min.css
      webfonts/
        fa-brands-400.eot
        fa-brands-400.svg
        fa-brands-400.tff
        fa-brands-400.woff
        fa-brands-400.woff2
        ...
        fa-duotone-900.eot
        ...
        fa-light-300.eot
        ...
        fa-regular-400.eot
        ...
        fa-solid-900.eot
        ...

You may also need to run the “Clear cache” tool from Directories -> System -> Tools.

How to show only listings that are near the current user location on initial page load?

Please first make sure that the filter form is enabled in your default view. You can enable filters in a view by editing the view from Directories -> [Your Directory] -> Content Types -> Listing -> Manage Views. https://directoriespro.com/documentation/getting-started/displaying-content-with-views.html

Then, please go to Directories -> [Your Directory] -> Content Types -> Listing -> Manage Views -> Manage Filters and make sure the “Location” filter is added there with both the Add “Search my location” button to map and Click “Search my location” button automatically on page load options switched on.

“Write a Review” button is not showing up for my listings!

Please first make sure that you have enabled reviews as instructed in the documentation. https://directoriespro.com/documentation/interacting-with-users/reviews.html

If your directory has payment features enabled, please make sure to switch on the “Enable reviews” option for your payment plans to enable reviews. For listings without a payment plan, you can switch on the same option under Directories -> [Your Directory] -> Content Types -> Listing -> Edit -> Payment -> Default Feature Settings.

I am getting an error message “The link you followed has expired.” when installing the plugin.

This does seem to happen when the max_upload_file of PHP on your server is set very low. This isn’t a bug but a matter of server settings and you should increase that limit to at least 5MB, otherwise even uploading a larger image file could cause the same issue.

You can either contact your hosting company and ask them to increase it for you or read the following article about how to do it yourself: http://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/

I am getting the following error on the checkout page: Table ‘xxxx.wp_drts_payment_featuregroup’ doesn’t exist

For some reason one or more of the database tables required by the Directories Payments plugin are not created in your database. Please first try running the “Reload components” tool from Directories -> System -> Tools and see if this fixes the issue.

If the issue persists, you will need to manually issue the following SQL queries against your WordPress database using a database management software such as phpMyAdmin on your server.

CREATE TABLE IF NOT EXISTS `wp_drts_payment_feature` (
  `feature_status` int(1) unsigned NOT NULL DEFAULT '0',
  `feature_feature_name` varchar(50) NOT NULL DEFAULT '',
  `feature_metas` text NOT NULL,
  `feature_logs` text NOT NULL,
  `feature_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `feature_created` int(10) unsigned NOT NULL DEFAULT '0',
  `feature_updated` int(10) unsigned NOT NULL DEFAULT '0',
  `feature_featuregroup_id` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`feature_id`),
  KEY `feature_featuregroup_id` (`feature_featuregroup_id`)
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS `wp_drts_payment_featuregroup` (
  `featuregroup_logs` text NOT NULL,
  `featuregroup_bundle_name` varchar(40) NOT NULL DEFAULT '',
  `featuregroup_order_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `featuregroup_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `featuregroup_created` int(10) unsigned NOT NULL DEFAULT '0',
  `featuregroup_updated` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`featuregroup_id`),
  KEY `featuregroup_bundle_name` (`featuregroup_bundle_name`)
) ENGINE=InnoDB;

If your database is using a database table prefix other than the default wp_, make sure to replace the wp_ part in the above queries with your custom database table prefix.

I am getting an error which states “Illegal mix of collations (utf8mb4_unicode_520_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) ...”

In order to fix this issue, please go to Directories -> System -> Tools, click the “Change table collation” button, select “utf8mb4_unicode_ci” and press the “Run Tool” button.

Show more

Contact the author

This author provides limited support for this item through email contact form.

Item support includes:

  • Availability of the author to answer questions
  • Answering technical questions about item’s features
  • Assistance with reported bugs and issues
  • Help with included 3rd party assets

However, item support does not include:

  • Customization services
  • Installation services

View the item support policy

by
by
by
by
by
by