Support » Plugin: WP Biographia » How to add Phone Number, Title, Company fields to bio box display?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author vicchi

    (@vicchi)

    Trying to add phone number, title, and company fields to the display on the biography box. How do I go about doing this? Where do I add the wp_biographia_contact_info filter?

    In general to add support for a new social network/contact link, you’ll need to add some code that calls the wp_biographia_contact_info and wp_biographia_link_items filters from your theme’s functions.php, before the closing ?> PHP tag.

    There’s an example of how to do this in the plugin’s Filter Support and Usage documentation.

    However, I’m not sure that all the information you want fits well into the WordPress contact links scheme as each contact method that you add to a user’s profile is effectively a URL link.

    Adding a company field would work well I think, as the link would be the company’s website address.

    A phone number is slightly more problematic. WordPress (and WP Biographia) uses the http: URI scheme for general web links and the mailto: URI scheme for the user’s email address. There is a tel: URI scheme for phone numbers that is defined in RFC 3966, but this isn’t natively supported in WP Biographia and not all browsers interpret this correctly, if at all. You could probably use the wp_biographia_link_item (note the singular form) filter to detect phone numbers and modify the markup the plugin emits to support the tel: URI scheme.

    But a user’s title doesn’t really make sense as a contact link as it’s typically not something that you can link to; unless you want to link to a user’s LinkedIn profile, but the plugin already natively supports this as a contact link in its own right.

    Can somebody provide me with an example? and PHP file this goes in

    To add support for the company to a user’s profile and to WP Biographia, you’ll want to put code into your theme’s functions.php, along the lines of …

    add_filter ('wp_biographia_contact_info', 'add_company_support');
    
    function add_company_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['company'] = array (
            'field' => 'company',
            'contactmethod' => __('Company')
        );
    
        return $contacts;
    }
    
    add_filter ('wp_biographia_link_items', 'add_company_link', 2);
    
    function add_company_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['pinterest'] = array (
            'link_title' => __('Company'),
            'link_text' => __('Company'),
            'link_icon' => $icon_dir_url . 'company.png'
            );
    
            return $links;
    }

    You’ll need to add a custom graphic file for the new link if you’re using link icons rather than text links; I’ve used company.png in the example above, but you’ll need to change this to whatever name you choose.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Haven’t heard back in over a week so I’m assuming this all works and I’m flagging this as resolved. Feel free to reopen if that’s not the case.

    -Gary

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add Phone Number, Title, Company fields to bio box display?’ is closed to new replies.