• Resolved piquezine

    (@piquezine)


    Hi.

    This is my site: https://www.piquezine.com

    I thought I followed your directions for adding additional social networks correctly, but I’m getting this error:
    Missing argument 2 for add_pinterest_link() in/home/content/e/k/z/ekzarkhov/html/piquezine/wp-content/themes/supreme/functions.php on line 258

    Following is the code I put into my functions.php. I have not yet added the pngs the social networks to the directory you specified. (I have added a second instance for website because I don’t want the default website field to link the author’s name to it.)

    add_filter ('wp_biographia_contact_info', 'add_pinterest_support');
    
    function add_pinterest_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['pinterest'] = array (
            'field' => 'pinterest',
            'contactmethod' => __('Pinterest')
        );
    
        return $contacts;
    }
    
    add_filter ('wp_biographia_link_items', 'add_pinterest_link', 2);
    
    function add_pinterest_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['pinterest'] = array (
            'link_title' => __('Pinterest'),
            'link_text' => __('Pinterest'),
            'link_icon' => $icon_dir_url . 'pinterest.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_tumblr_support');
    
    function add_tumblr_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['tumblr'] = array (
            'field' => 'tumblr',
            'contactmethod' => __('tumblr')
        );
    
        return $contacts;
    }
    
    add_filter ('wp_biographia_link_items', 'add_tumblr_link', 2);
    
    function add_tumblr_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['tumblr'] = array (
            'link_title' => __('tumblr'),
            'link_text' => __('tumblr'),
            'link_icon' => $icon_dir_url . 'tumblr.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_goodreads_support');
    
    function add_goodreads_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['goodreads'] = array (
            'field' => 'goodreads',
            'contactmethod' => __('goodreads')
        );
    
        return $contacts;
    }
    
    add_filter ('wp_biographia_link_items', 'add_goodreads_link', 2);
    
    function add_goodreads_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['goodreads'] = array (
            'link_title' => __('goodreads'),
            'link_text' => __('goodreads'),
            'link_icon' => $icon_dir_url . 'goodreads.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_amazon_support');
    
    function add_amazon_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['amazon'] = array (
            'field' => 'amazon',
            'contactmethod' => __('Amazon')
        );
    
        return $contacts;
    }
    
    add_filter ('wp_biographia_link_items', 'add_amazon_link', 2);
    
    function add_amazon_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['amazon'] = array (
            'link_title' => __('Amazon'),
            'link_text' => __('Amazon'),
            'link_icon' => $icon_dir_url . 'amazon.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_website_support');
    
    function add_website_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['website'] = array (
            'field' => 'website',
            'contactmethod' => __('website')
        );
    
        return $contacts;
    }
    
    add_filter ('wp_biographia_link_items', 'add_webiste_link', 2);
    
    function add_webiste_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['website'] = array (
            'link_title' => __('website'),
            'link_text' => __('website'),
            'link_icon' => $icon_dir_url . 'website.png'
            );
    
            return $links;
    }

    Also, I’m not able to get the author box to show up in the sidebar, unless I put in the widget and then below that I put a text widget with the following shortcode in it.

    [wp-biographia]

    Thank you!

    https://www.ads-software.com/plugins/wp-biographia/

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

    (@vicchi)

    There’s a syntax error in the second call to add_filter in the code you’ve used (this is a documentation error in the current version of the plugin; it’s fixed in the plugin’s documentation and will be fixed in the readme.txt for the next version of the plugin). The syntax should be …

    add_filter($tag, $function, $priority, $accepted_args);

    … but your code is missing the $priority argument, so if you correct it to …

    add_filter('wp_biographia_link_items', 'add_pinterest_link', 10, 2);

    … it should work.

    I’m not quite sure what you mean by

    Also, I’m not able to get the author box to show up in the sidebar, unless I put in the widget

    The plugin’s widget is designed to be put into the sidebar; I don’t follow what you mean by the Biography Box (author box) not showing up? Is the widget showing in the sidebar at all, or are there sections of the Biography Box not showing up in the widget’s output?

    -Gary

    Thread Starter piquezine

    (@piquezine)

    Thanks for the prompt reply. I’ll have to check it out when I get home. Massive help! ??

    On the second point, when I’m home I’ll investigate so I can be more specific in my question. It’s working, but not as it should be.

    Thread Starter piquezine

    (@piquezine)

    Hmmmm… So this is what happened:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘add_website_link’ was given in /home/content/e/k/z/ekzarkhov/html/piquezine/wp-includes/plugin.php on line 199

    Warning: Invalid argument supplied for foreach() in /home/content/e/k/z/ekzarkhov/html/piquezine/wp-content/plugins/wp-biographia/wp-biographia.php on line 1572

    This is the code I inserted with your syntax change. Did I do that right? Apparently not. :\

    add_filter ('wp_biographia_contact_info', 'add_pinterest_support');
    
    function add_pinterest_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['pinterest'] = array (
            'field' => 'pinterest',
            'contactmethod' => __('Pinterest')
        );
    
        return $contacts;
    }
    
    add_filter('wp_biographia_link_items', 'add_pinterest_link', 10, 2);
    
    function add_pinterest_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['pinterest'] = array (
            'link_title' => __('Pinterest'),
            'link_text' => __('Pinterest'),
            'link_icon' => $icon_dir_url . 'pinterest.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_tumblr_support');
    
    function add_tumblr_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['tumblr'] = array (
            'field' => 'tumblr',
            'contactmethod' => __('tumblr')
        );
    
        return $contacts;
    }
    
    add_filter('wp_biographia_link_items', 'add_tumblr_link', 10, 2);
    
    function add_tumblr_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['tumblr'] = array (
            'link_title' => __('tumblr'),
            'link_text' => __('tumblr'),
            'link_icon' => $icon_dir_url . 'tumblr.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_goodreads_support');
    
    function add_goodreads_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['goodreads'] = array (
            'field' => 'goodreads',
            'contactmethod' => __('goodreads')
        );
    
        return $contacts;
    }
    
    add_filter('wp_biographia_link_items', 'add_goodreads_link', 10, 2);
    
    function add_goodreads_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['goodreads'] = array (
            'link_title' => __('goodreads'),
            'link_text' => __('goodreads'),
            'link_icon' => $icon_dir_url . 'goodreads.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_amazon_support');
    
    function add_amazon_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['amazon'] = array (
            'field' => 'amazon',
            'contactmethod' => __('Amazon')
        );
    
        return $contacts;
    }
    
    add_filter('wp_biographia_link_items', 'add_amazon_link', 10, 2);
    
    function add_amazon_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['amazon'] = array (
            'link_title' => __('Amazon'),
            'link_text' => __('Amazon'),
            'link_icon' => $icon_dir_url . 'amazon.png'
            );
    
            return $links;
    }
    
    add_filter ('wp_biographia_contact_info', 'add_website_support');
    
    function add_website_support ($contacts) {
        // contacts = array (field => array (field => field-name, contactmethod => description))
        $contacts['website'] = array (
            'field' => 'website',
            'contactmethod' => __('website')
        );
    
        return $contacts;
    }
    
    add_filter('wp_biographia_link_items', 'add_website_link', 10, 2);
    
    function add_webiste_link ($links, $icon_dir_url) {
        // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
        $links['website'] = array (
            'link_title' => __('website'),
            'link_text' => __('website'),
            'link_icon' => $icon_dir_url . 'website.png'
            );
    
            return $links;
    }

    Plugin Author vicchi

    (@vicchi)

    I think the problem is that you’re using multiple versions of the filters, one per contact link that you want to add and that’s confusing the plugin. If you batch up your contact links, as below, this should work (I’ve just tested this on my local install and it’s working fine for me)

    if (!function_exists('add_custom_links') && !function_exists('display_custom_links')) {
    	add_filter('wp_biographia_contact_info', 'add_custom_links');
    	function add_custom_links($contacts) {
    	    // contacts = array (field => array (field => field-name, contactmethod => description))
    		$custom = array(
    			'pinterest' => array(
    				'field' => 'pinterest',
    				'contactmethod' => __('Pinterest')
    			),
    			'tumblr' => array(
    				'field' => 'tumblr',
    				'contactmethod' => __('Tumblr')
    			),
    			'goodreads' => array(
    				'field' => 'goodreads',
    				'contactmethod' => __('Goodreads')
    			),
    			'amazon' => array(
    				'field' => 'amazon',
    				'contactmethod' => __('Amazon')
    			)
    		);
    
    		return array_merge($contacts, $custom);
    	}
    
    	add_filter('wp_biographia_link_items', 'display_custom_links', 10, 2);
    	function display_custom_links($links, $icon_dir_url) {
    	    // links = array (field => array (link_title => title, link_text => text, link_icon => URL)
    		$custom = array(
    			'pinterest' => array(
    				'link_title' => __('Pinterest'),
    				'link_text' => __('Pinterest'),
    				'link_icon' => $icon_dir_url . 'pinterest.png'
    			),
    			'tumblr' => array(
    				'link_title' => __('Tumblr'),
    				'link_text' => __('Tumblr'),
    				'link_icon' => $icon_dir_url . 'tumblr.png'
    			),
    			'goodreads' => array(
    				'link_title' => __('Goodreads'),
    				'link_text' => __('Goodreads'),
    				'link_icon' => $icon_dir_url . 'goodreads.png'
    			),
    			'amazon' => array(
    				'link_title' => __('Amazon'),
    				'link_text' => __('Amazon'),
    				'link_icon' => $icon_dir_url . 'amazon.png'
    			)
    		);
    		return array_merge($links, $custom);
    	}
    }

    Note that I haven’t included your website link … this is already part of the standard set of contact links that appear in the user’s profile (with a key of web in the user_contactmethods filter’s arguments) so it looks to me like this is just duplicating what’s already in WordPress. If you do need a secondary website link, then you can just (re)add the applicable entries to both filter hooks.

    -Gary

    Thread Starter piquezine

    (@piquezine)

    That worked! And I did want to have that second instance of “website.” The standard website link ends up linking the author name in the post details to that external site, and we didn’t want that. I ended up adding a “publisher” link for the authors too.

    This plugin is great! And your support has been really helpful. Thank you!

    Plugin Author vicchi

    (@vicchi)

    You’re very welcome; glad to see it all got sorted for you.

    -Gary

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘error when adding other social networks’ is closed to new replies.