facebook.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Views
  6. */
  7. /**
  8. * @var Yoast_Form $yform
  9. */
  10. if ( ! defined( 'WPSEO_VERSION' ) ) {
  11. header( 'Status: 403 Forbidden' );
  12. header( 'HTTP/1.1 403 Forbidden' );
  13. exit();
  14. }
  15. echo '<h2>' . esc_html__( 'Facebook settings', 'wordpress-seo' ) . '</h2>';
  16. $yform->light_switch( 'opengraph', __( 'Add Open Graph meta data', 'wordpress-seo' ) );
  17. ?>
  18. <p>
  19. <?php
  20. esc_html_e( 'Enable this feature if you want Facebook and other social media to display a preview with images and a text excerpt when a link to your site is shared.', 'wordpress-seo' );
  21. ?>
  22. </p>
  23. <?php
  24. $yform->textinput( 'fbadminapp', __( 'Facebook App ID', 'wordpress-seo' ) );
  25. if ( 'posts' === get_option( 'show_on_front' ) ) {
  26. $social_facebook_frontpage_help = new WPSEO_Admin_Help_Panel(
  27. 'social-facebook-frontpage',
  28. esc_html__( 'Learn more about the title separator setting', 'wordpress-seo' ),
  29. esc_html__( 'These are the title, description and image used in the Open Graph meta tags on the front page of your site.', 'wordpress-seo' ),
  30. 'has-wrapper'
  31. );
  32. echo '<h2 class="help-button-inline">' . esc_html__( 'Frontpage settings', 'wordpress-seo' ) . $social_facebook_frontpage_help->get_button_html() . '</h2>';
  33. echo $social_facebook_frontpage_help->get_panel_html();
  34. $yform->media_input( 'og_frontpage_image', __( 'Image URL', 'wordpress-seo' ) );
  35. $yform->textinput( 'og_frontpage_title', __( 'Title', 'wordpress-seo' ) );
  36. $yform->textinput( 'og_frontpage_desc', __( 'Description', 'wordpress-seo' ) );
  37. $copy_home_description_button_label = esc_html__( 'Copy home meta description', 'wordpress-seo' );
  38. // Offer copying of meta description.
  39. $homepage_meta_description = WPSEO_Options::get( 'metadesc-home-wpseo' );
  40. if ( ! empty( $homepage_meta_description ) ) {
  41. $copy_home_meta_desc_help = new WPSEO_Admin_Help_Panel(
  42. 'copy-home-meda-desc',
  43. esc_html__( 'Help on copying the home meta description', 'wordpress-seo' ),
  44. sprintf(
  45. /* translators: 1: link open tag; 2: link close tag., 3: the translated label of the button */
  46. esc_html__( 'Click the "%3$s" button to use the meta description already set in the %1$sSearch Appearance Homepage%2$s setting.', 'wordpress-seo' ),
  47. '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_titles' ) ) . '">',
  48. '</a>',
  49. $copy_home_description_button_label
  50. )
  51. );
  52. echo '<input type="hidden" id="meta_description" value="', $homepage_meta_description, '" />';
  53. echo '<div class="label desc copy-home-meta-description">' .
  54. '<button type="button" id="copy-home-meta-description" class="button">', $copy_home_description_button_label, '</button>' .
  55. $copy_home_meta_desc_help->get_button_html() .
  56. $copy_home_meta_desc_help->get_panel_html() .
  57. '</div>';
  58. }
  59. }
  60. echo '<h2>' . esc_html__( 'Default settings', 'wordpress-seo' ) . '</h2>';
  61. $yform->media_input( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) );
  62. ?>
  63. <p class="desc label">
  64. <?php esc_html_e( 'This image is used if the post/page being shared does not contain any images.', 'wordpress-seo' ); ?>
  65. </p>
  66. <?php
  67. do_action( 'wpseo_admin_opengraph_section' );