facebook.php 3.1 KB

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