setting_enabled['toggle-social']) ? $siteseo->setting_enabled['toggle-social'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_knowledge_graph'; // Default tab $social_subtabs = [ 'tab_knowledge_graph' => esc_html__('Knowledge Graph', 'siteseo'), 'tab_social_accounts' => esc_html__('Your social accounts', 'siteseo'), 'tab_facebook' => esc_html__('Facebook (Open Graph) ', 'siteseo'), 'tab_twitter' => esc_html__('Twitter (Twitter card)', 'siteseo') ]; echo'
'; wp_nonce_field('siteseo_social_settings'); Dashbord::render_toggle('Social Networks - SiteSEO', 'social_toggle', $social_toggle, $nonce); echo'
'; self::knowledge_graph(); echo'
'; self::social_accouts(); echo'
'; self::twitter(); echo'
'; self::facebook(); echo'
'; siteseo_submit_button(__('save changes', 'siteseo')); echo''; } static function knowledge_graph(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_social_option_name'); //load data $option_org_type = isset($options['social_knowledge_type']) ? $options['social_knowledge_type'] : ''; $option_org_name = isset($options['social_knowledge_name']) ? $options['social_knowledge_name'] : ''; $option_org_logo = isset($options['social_knowledge_img']) ? $options['social_knowledge_img'] : ''; $option_org_number = isset($options['social_knowledge_phone']) ? $options['social_knowledge_phone'] : ''; $option_org_contact_type = isset($options['social_knowledge_contact_type']) ? $options['social_knowledge_contact_type'] : ''; $option_org_contact_option = isset($options['social_knowledge_contact_option']) ? $options['social_knowledge_contact_option'] : ''; echo'

Knowledge Graph

Configure Google Knowledge Graph.

Person or organization
Your name/organization
Your photo/organization logo

JPG, PNG, WebP and GIF allowed.

Organizations phone number (only for Organizations)
Contact type (only for Organizations)
Contact option (only for Organizations)
'; } static function social_accouts(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->social_settings; $options = get_option('siteseo_social_option_name'); //load settings $options_facebook_acct = isset($options['social_accounts_facebook']) ? $options['social_accounts_facebook'] : ''; $options_twitter_acct = isset($options['social_accounts_twitter']) ? $options['social_accounts_twitter'] : ''; $options_instagram_acct = isset($options['social_accounts_instagram']) ? $options['social_accounts_instagram'] : ''; $options_youtube_acct = isset($options['social_accounts_youtube']) ? $options['social_accounts_youtube'] : ''; $options_pinterest_acct = isset($options['social_accounts_pinterest']) ? $options['social_accounts_pinterest'] : ''; echo'

Your social accouts

Facebook
X Username
Pinterest URL
Instagram URL
YouTube URL
'; } static function twitter(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->social_settings; $options = get_option('siteseo_social_option_name'); //load data $option_enable_card = isset($options['social_twitter_card']) ? $options['social_twitter_card'] : 1; $options_og_card = isset($options['social_twitter_card_og']) ? $options['social_twitter_card_og'] : ''; $option_image_size = isset($options['social_twitter_card_img_size']) ? $options['social_twitter_card_img_size'] : ''; $option_twitter_img = isset($options['social_twitter_card_img']) ? $options['social_twitter_card_img'] : ''; echo'

Twitter (Twitter card)

Manage your Twitter card.

'.wp_kses_post(__('We generate the og:image meta in this order:', 'siteseo')).'

  1. '.esc_html__('Custom OG Image from SEO metabox', 'siteseo').'
  2. '.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'
  3. '.esc_html__('First image of your post content', 'siteseo').'
  4. '.esc_html__('Global OG Image set in SEO > Social > Open Graph', 'siteseo').'
  5. '.esc_html__('Site icon from the Customizer', 'siteseo').'
Twitter (Twitter card) Manage your Twitter card.
Enable Twitter card
Use OG if no Twitter Cards
Default Twitter Image

Minimum size: 144x144px (300x157px with large card enabled), ideal ratio 1:1 (2:1 with large card), 5Mb max.

Twitter Card Image Size
'; } static function facebook(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } // load seetings //$options = $siteseo->social_settings; $options = get_option('siteseo_social_option_name'); $option_fb_enable_og = isset($options['social_facebook_og']) ? $options['social_facebook_og'] : 1; $option_fb_img = isset($options['social_facebook_img']) ? $options['social_facebook_img'] : ''; $option_fb_defult_img = isset($options['social_facebook_img_default']) ? $options['social_facebook_img_default'] : ''; $option_fb_ownership = isset($options['social_facebook_link_ownership_id']) ? $options['social_facebook_link_ownership_id'] : ''; $option_fb_admin_id = isset($options['social_facebook_admin_id']) ? $options['social_facebook_admin_id'] : ''; echo'

Facebook (Open Graph)

Manage Open Graph data. These metatags will be used by Facebook, Pinterest, LinkedIn, WhatsApp... when a user shares a link on its own social network. Increase your click-through rate by providing relevant information such as an attractive image.

'.wp_kses_post(__('We generate the twitter:image meta in this order:', 'siteseo')).'

  1. '.esc_html__('Custom Twitter image from SEO metabox', 'siteseo'). '
  2. '.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'
  3. '.esc_html__('First image of your post content', 'siteseo').'
  4. '.esc_html__('Global Twitter:image set in SEO > Social > Twitter Card', 'siteseo').'
Enable OG date
Default Image

Minimum size: 200x200px, ideal ratio 1.91:1, 8Mb max. (eg: 1640x856px or 3280x1712px for retina screens)

If no default image is set, we‘ll use your site icon defined from the Customizer.

Override Default Image

Please define a default OG Image from the field above

Link Ownership ID

One or more Facebook Page IDs that are associated with a URL in order to enable link editing and instant article publishing.

' . esc_html('') . '
Admin ID

The ID (or comma-separated list for properties that can accept multiple IDs) of an app, person using the app, or Page Graph API object.

' . esc_html('') . '
'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_social_settings'); if(!current_user_can('manage_options') || !is_admin()){ return; } $options = []; if(empty($_POST['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['knowledge_graph_tab'])){ $options['social_knowledge_type'] = isset($_POST['siteseo_options']['org_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_type'])) : ''; $options['social_knowledge_name'] = isset($_POST['siteseo_options']['org_name']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_name'])) : ''; $options['social_knowledge_img'] = isset($_POST['siteseo_options']['org_logo']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_logo'])) : ''; $options['social_knowledge_phone'] = isset($_POST['siteseo_options']['org_contact_number']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_number'])) : ''; $options['social_knowledge_contact_type'] = isset($_POST['siteseo_options']['org_contact_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_type'])) : ''; $options['social_knowledge_contact_option'] = isset($_POST['siteseo_options']['org_contact_option']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_option'])) : ''; } if(isset($_POST['siteseo_options']['social_account_tab'])){ $options['social_accounts_facebook'] = isset($_POST['siteseo_options']['facebook']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['facebook'])) : ''; $options['social_accounts_twitter'] = isset($_POST['siteseo_options']['twitter']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['twitter'])) : ''; $options['social_accounts_instagram'] = isset($_POST['siteseo_options']['instagram']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['instagram'])) : ''; $options['social_accounts_youtube'] = isset($_POST['siteseo_options']['youtube']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['youtube'])) : ''; $options['social_accounts_pinterest'] = isset($_POST['siteseo_options']['pinterest']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['pinterest'])) : ''; } if(isset($_POST['siteseo_options']['facebook_tab'])){ $options['social_facebook_og'] = isset($_POST['siteseo_options']['enable_fb_og']); $options['social_facebook_img'] = isset($_POST['siteseo_options']['fb_image']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['fb_image'])) : ''; $options['social_facebook_img_default'] = isset($_POST['siteseo_options']['fb_default_img']); $options['social_facebook_link_ownership_id'] = isset($_POST['siteseo_options']['fb_owership_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['fb_owership_id'])) : ''; $options['social_facebook_admin_id'] = isset($_POST['siteseo_options']['fb_admin_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['fb_admin_id'])) : ''; } if(isset($_POST['siteseo_options']['twitter_tab'])){ $options['social_twitter_card'] = isset($_POST['siteseo_options']['enable_twitter_card']); $options['social_twitter_card_og'] = isset($_POST['siteseo_options']['card_og']); $options['social_twitter_card_img'] = isset($_POST['siteseo_options']['twitter_img']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['twitter_img'])) : ''; $options['social_twitter_card_img_size'] = isset($_POST['siteseo_options']['image_size']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['image_size'])) : ''; } update_option('siteseo_social_option_name' , $options); } }