WPSEO_Taxonomy_Social_Fields::get_by_network PHP Method

get_by_network() public method

Gets the social meta fields by social network for the taxonomy.
public get_by_network ( string $network ) : array
$network string The social network for which to fetch the fields.
return array
    public function get_by_network($network)
    {
        $settings = $this->networks[$network];
        return array($settings['network'] . '-title' => $this->get_field_config(sprintf(__('%s Title', 'wordpress-seo'), $settings['label']), sprintf(esc_html__('If you don\'t want to use the title for sharing on %1$s but instead want another title there, write it here.', 'wordpress-seo'), $settings['label']), 'text', array('class' => 'large-text')), $settings['network'] . '-description' => $this->get_field_config(sprintf(__('%s Description', 'wordpress-seo'), $settings['label']), sprintf(esc_html__('If you don\'t want to use the meta description for sharing on %1$s but want another description there, write it here.', 'wordpress-seo'), $settings['label']), 'textarea'), $settings['network'] . '-image' => $this->get_field_config(sprintf(__('%s Image', 'wordpress-seo'), $settings['label']), sprintf(esc_html__('If you want to use an image for sharing on %1$s, you can upload / choose an image or add the image URL here.', 'wordpress-seo'), $settings['label']) . '<br />' . sprintf(__('The recommended image size for %1$s is %2$s pixels.', 'wordpress-seo'), $settings['label'], $settings['size']), 'upload'));
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Returns the metabox section for the social settings.
  *
  * @return WPSEO_Metabox_Section
  */
 private function get_social_meta_section()
 {
     $options = WPSEO_Options::get_option('wpseo_social');
     $taxonomy_social_fields = new WPSEO_Taxonomy_Social_Fields($this->term);
     $tabs = array();
     $single = true;
     if ($options['opengraph'] === true && $options['twitter'] === true) {
         $single = null;
     }
     if ($options['opengraph'] === true) {
         $facebook_meta_fields = $taxonomy_social_fields->get_by_network('opengraph');
         $tabs[] = new WPSEO_Metabox_Form_Tab('facebook', $this->taxonomy_tab_content->html($facebook_meta_fields), '<span class="screen-reader-text">' . __('Facebook / Open Graph metadata', 'wordpress-seo') . '</span><span class="dashicons dashicons-facebook-alt"></span>', array('link_aria_label' => __('Facebook / Open Graph metadata', 'wordpress-seo'), 'link_class' => 'yoast-tooltip yoast-tooltip-se', 'single' => $single));
     }
     if ($options['twitter'] === true) {
         $twitter_meta_fields = $taxonomy_social_fields->get_by_network('twitter');
         $tabs[] = new WPSEO_Metabox_Form_Tab('twitter', $this->taxonomy_tab_content->html($twitter_meta_fields), '<span class="screen-reader-text">' . __('Twitter metadata', 'wordpress-seo') . '</span><span class="dashicons dashicons-twitter"></span>', array('link_aria_label' => __('Twitter metadata', 'wordpress-seo'), 'link_class' => 'yoast-tooltip yoast-tooltip-se', 'single' => $single));
     }
     return new WPSEO_Metabox_Tab_Section('social', '<span class="screen-reader-text">' . __('Social', 'wordpress-seo') . '</span><span class="dashicons dashicons-share"></span>', $tabs, array('link_aria_label' => __('Social', 'wordpress-seo'), 'link_class' => 'yoast-tooltip yoast-tooltip-e'));
 }
All Usage Examples Of WPSEO_Taxonomy_Social_Fields::get_by_network