Пример #1
0
if (!empty($twitter_account) && !hocwp_url_valid($twitter_account)) {
    $twitter_account = 'http://twitter.com/' . $twitter_account;
}
$option->add_field(array('id' => 'twitter_site', 'title' => __('Twitter URL', 'hocwp-theme'), 'value' => $twitter_account));
$option->add_field(array('id' => 'instagram_url', 'title' => __('Instagram URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('instagram_url')));
$option->add_field(array('id' => 'linkedin_url', 'title' => __('LinkedIn URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('linkedin_url')));
$option->add_field(array('id' => 'myspace_url', 'title' => __('Myspace URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('myspace_url')));
$option->add_field(array('id' => 'pinterest_url', 'title' => __('Pinterest URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('pinterest_url')));
$option->add_field(array('id' => 'youtube_url', 'title' => __('YouTube URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('youtube_url')));
$option->add_field(array('id' => 'google_plus_url', 'title' => __('Google+ URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('google_plus_url')));
$option->add_field(array('id' => 'rss_url', 'title' => __('RSS URL', 'hocwp-theme')));
$option->add_field(array('id' => 'addthis_id', 'title' => __('AddThis ID', 'hocwp-theme'), 'section' => 'account'));
$option->add_field(array('id' => 'fbadminapp', 'title' => __('Facebook App ID', 'hocwp-theme'), 'section' => 'facebook', 'value' => hocwp_get_wpseo_social_value('fbadminapp')));
$option->add_field(array('id' => 'google_api_key', 'title' => __('Google API Key', 'hocwp-theme'), 'section' => 'google'));
$option->add_field(array('id' => 'google_client_id', 'title' => __('Google Client ID', 'hocwp-theme'), 'section' => 'google'));
$option->add_option_tab($hocwp_tos_tabs);
$option->set_page_header_callback('hocwp_theme_option_form_before');
$option->set_page_footer_callback('hocwp_theme_option_form_after');
$option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab');
$option->init();
hocwp_option_add_object_to_list($option);
function hocwp_option_social_update($input)
{
    $key = 'facebook_site';
    if (isset($input[$key])) {
        hocwp_update_wpseo_social($key, $input[$key]);
    }
    $key = 'twitter_site';
    if (isset($input[$key])) {
        hocwp_update_wpseo_social($key, $input[$key]);
    }
 final function add_option_to_sidebar_tab(HOCWP_Option $option)
 {
     if (!hocwp_menu_page_exists($this->option_name)) {
         global $hocwp_pos_tabs;
         $option->set_parent_slug($this->admin_menu_parent);
         $option->add_option_tab($hocwp_pos_tabs);
         $option->set_page_header_callback('hocwp_plugin_option_page_header');
         $option->set_page_footer_callback('hocwp_plugin_option_page_footer');
         $option->set_page_sidebar_callback('hocwp_plugin_option_page_sidebar');
     }
 }