DEIN BENUTZER-Profil um Weitere Social Media-Konten Erweitern
<?php
/**
* Managing contact fields for author bio
*/
$evolution_pro_Contactfields = new evolution_pro_Contactfields(
// Fehlende Accounts kannst du leicht ergänzen
array (
'Feed',
'Twitter',
'Facebook',
'GooglePlus',
'Flickr',
'Xing',
'Github',
'Instagram',
'LinkedIn',
'Pinterest',
'Vimeo',
'Youtube'
)
);
class evolution_pro_Contactfields {
public
$new_fields
, $active_fields
, $replace
;
/**
* @param array $fields New fields: array ('Twitter', 'Facebook')
* @param bool $replace Replace default fields?
*/
public function __construct($fields, $replace = TRUE)
{
foreach ( $fields as $field )
{
$this->new_fields[ mb_strtolower($field, 'utf-8') ] = $field;
}
$this->replace = (bool) $replace;
add_filter('user_contactmethods', array( $this, 'add_fields' ) );
}
/**
* Changing contact fields
* @param $original_fields Original WP fields
* @return array
*/
public function add_fields($original_fields)
{
if ( $this->replace )
{
$this->active_fields = $this->new_fields;
return $this->new_fields;
}
$this->active_fields = array_merge($original_fields, $this->new_fields);
return $this->active_fields;
}
/**
* Helper function
* @return array The currently active fields.
*/
public function get_active_fields()
{
return $this->active_fields;
}
}
Dangerous Dormouse