• Resolved djguapo

    (@djguapo)


    In Directory Builder for dDoctors, I’m trying to insert fields that are not displayed as options by default. For example, in the Single Page Layout under the Listing Header for the Top Right, the options available are: Bookmark, Share, Leave Review, and Report. I’d like to add other fields such as: Location, Website, and Category. That way the Single Page listing is as personalized as it can be.

    I know that changing this requires to edit the PHP, so I dug around in the plugin/theme files and found that all the functions of the Single Listing page are located in class-multi-directory-manager.php, and specifically line 4447 contains the list of accepted widgets for the Top Right section:

    'listings_header' => [
        'quick_actions' => [
            'label' => __( 'Top Right', 'directorist' ),
            'maxWidget' => 0,
            'maxWidgetInfoText' => "Up to __DATA__ item{s} can be added",
            'acceptedWidgets' => [ 'bookmark', 'share', 'report' ],
        ],

    I was able to replace one of those widgets with ‘location’ and the code worked, but if I insert any of my other fields of choice (such as Website), this field is not exposed in the Directory Builder under this section.

    What is the missing piece that allows location to be available as an option, but not any of the other fields?

    And before you say anything, I know that editing the plugin code is risky because any plugin/theme edits might overwrite any custom code. I am aware of this and document all my work so that when an update does do this, I can go back and re-insert my customizations (as this recently happened).

    (Link is to Single Listing page from demo where you can see the 4 options in the top right)

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @djguapo, sorry about the delay in response, we were on vacation.

    You are pretty close. You just need to register the fields that you want to show as a widget. To do that, just add them to the widgets array that starts on line #4404 of the same file. For example, the website field should be something like this:

    'Website' => [
                            'type' => "badge",
                            'label' => __( "Website", "directorist" ),
                            'icon' => 'uil uil-text-fields',
                            'show_if' => [
                                'where' => "submission_form_fields.value.fields",
                                'conditions' => [
                                    ['key' => '_any.widget_name', 'compare' => '=', 'value' => 'website'],
                                ],
                            ],
                        ],

    This should work, let me know if you need help with anything else.

    Regards,
    Mahdi.

    Thread Starter djguapo

    (@djguapo)

    Hi there, unfortunately that did not work. I did need to make the first “Website” reference in your code lowercase for it to appear. Once it did, though, all that appeared was just the word “Website” and not the URL that is saved in the Add Listing form for the listing.

    Any other ideas?

    Hey @djguapo,

    Interesting. We’ll have to take a closer look. Can you get in touch with our technical support: https://directorist.com/contact, please?

    Regards,
    Mahdi.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Non-Default Fields in Single Page Listing’ is closed to new replies.