• Resolved jonyxjake

    (@jonyxjake)


    I want users to only pick between specific socials. I′d like to eliminate some of them and include discord. Is this possible??

    Is this possible with css? – Is there another option?

    Kind regards

Viewing 1 replies (of 1 total)
  • Plugin Support Mahfuzul Alam

    (@mahfuz87)

    Hi

    Thank you for the query.
    Yes, it is possible to add or remove options from the social items. But, it will require some custom development and template overriding.

    Here, you will find documentation on template overriding – https://directorist.com/documentation/directorist/developers-guide/template-override/

    You need to override the file in the path – “/directorist/templates/listing-form/social-item.php”

    Here is an example of code to add and remove an option. You can override with this code –

    <?php
    
    /**
     * @author  wpWax
     * @since   6.6
     * @version 7.3.1
     */
    
    if (!defined('ABSPATH')) exit;
    
    $social_items = ATBDP()->helper->social_links();
    //Add an option
    $social_items['discord'] = 'Discord';
    //Remove an option
    unset($social_items['flickr']);
    
    $id = (array_key_exists('id', $args)) ? $args['id'] : $index; ?>
    
    <div class="directorist-form-social-fields" id="socialID-<?php echo esc_attr($id); ?>">
        <div class="directorist-form-group">
            <select name="social[<?php echo esc_attr($id); ?>][id]" class="directorist-form-element">
                <?php foreach ($social_items as $nameID => $socialName) { ?>
                    <option value="<?php echo esc_attr($nameID); ?>" <?php selected($nameID, $social_info['id']); ?>><?php echo esc_html($socialName); ?></option>
                <?php } ?>
            </select>
        </div>
        <div class="directorist-form-group">
            <input type="url" name="social[<?php echo esc_attr($id); ?>][url]" class="directorist-form-element directory_field atbdp_social_input" value="<?php echo esc_url($social_info['url']); ?>" placeholder="<?php esc_attr_e('eg. https://example.com', 'directorist'); ?>" required>
        </div>
        <div class="directorist-form-group directorist-form-social-fields__action">
            <span data-id="<?php echo esc_attr($id); ?>" class="directorist-form-social-fields__remove dashicons dashicons-trash" title="<?php esc_html_e('Remove this item', 'directorist'); ?>"></span>
        </div>
    </div>

    I hope this solution will help you. Please inform us if you need further assistance.

    Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Customize social Info options’ is closed to new replies.