PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/news/library/admin/meta-box-theme-about.php

https://bitbucket.org/lgorence/quickpress
PHP | 94 lines | 50 code | 10 blank | 34 comment | 2 complexity | 43f533dfb0d340aa59eb143efd0de867 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. /**
  3. * Creates a meta box for the theme settings page, which displays information about the theme. If a child
  4. * theme is in use, an additional meta box will be added with its information. To use this feature, the theme
  5. * must support the 'about' argument for 'hybrid-core-theme-settings' feature.
  6. *
  7. * @package HybridCore
  8. * @subpackage Admin
  9. * @author Justin Tadlock <justin@justintadlock.com>
  10. * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
  11. * @link http://themehybrid.com/hybrid-core
  12. * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  13. */
  14. /* Create the about theme meta box on the 'add_meta_boxes' hook. */
  15. add_action( 'add_meta_boxes', 'hybrid_meta_box_theme_add_about' );
  16. /**
  17. * Adds the core about theme meta box to the theme settings page.
  18. *
  19. * @since 1.2.0
  20. * @return void
  21. */
  22. function hybrid_meta_box_theme_add_about() {
  23. /* Get theme information. */
  24. $prefix = hybrid_get_prefix();
  25. $theme = wp_get_theme( get_template(), get_theme_root( get_template_directory() ) );
  26. /* Adds the About box for the parent theme. */
  27. add_meta_box( 'hybrid-core-about-theme', sprintf( __( 'About %s', 'hybrid-core' ), $theme->get( 'Name' ) ), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high' );
  28. /* If the user is using a child theme, add an About box for it. */
  29. if ( is_child_theme() ) {
  30. $child = wp_get_theme( get_stylesheet(), get_theme_root( get_stylesheet_directory() ) );
  31. add_meta_box( 'hybrid-core-about-child', sprintf( __( 'About %s', 'hybrid-core' ), $child->get( 'Name' ) ), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high' );
  32. }
  33. }
  34. /**
  35. * Creates an information meta box with no settings about the theme. The meta box will display
  36. * information about both the parent theme and child theme. If a child theme is active, this function
  37. * will be called a second time.
  38. *
  39. * @since 1.2.0
  40. * @param object $object Variable passed through the do_meta_boxes() call.
  41. * @param array $box Specific information about the meta box being loaded.
  42. * @return void
  43. */
  44. function hybrid_meta_box_theme_display_about( $object, $box ) {
  45. /* Get theme information. */
  46. $prefix = hybrid_get_prefix();
  47. /* Grab theme information for the parent/child theme. */
  48. $theme = ( 'hybrid-core-about-child' == $box['id'] ) ? wp_get_theme( get_stylesheet(), get_theme_root( get_stylesheet_directory() ) ) : wp_get_theme( get_template(), get_theme_root( get_template_directory() ) ); ?>
  49. <table class="form-table">
  50. <tr>
  51. <th>
  52. <?php _e( 'Theme:', 'hybrid-core' ); ?>
  53. </th>
  54. <td>
  55. <a href="<?php echo esc_url( $theme->get( 'ThemeURI' ) ); ?>" title="<?php echo esc_attr( $theme->get( 'Name' ) ); ?>"><?php echo $theme->get( 'Name' ); ?></a>
  56. </td>
  57. </tr>
  58. <tr>
  59. <th>
  60. <?php _e( 'Version:', 'hybrid-core' ); ?>
  61. </th>
  62. <td>
  63. <?php echo $theme->get( 'Version' ); ?>
  64. </td>
  65. </tr>
  66. <tr>
  67. <th>
  68. <?php _e( 'Author:', 'hybrid-core' ); ?>
  69. </th>
  70. <td>
  71. <a href="<?php echo esc_url( $theme->get( 'AuthorURI' ) ); ?>" title="<?php echo esc_attr( $theme->get( 'Author' ) ); ?>"><?php echo $theme->get( 'Author' ); ?></a>
  72. </td>
  73. </tr>
  74. <tr>
  75. <th>
  76. <?php _e( 'Description:', 'hybrid-core' ); ?>
  77. </th>
  78. <td>
  79. <?php echo $theme->get( 'Description' ); ?>
  80. </td>
  81. </tr>
  82. </table><!-- .form-table --><?php
  83. }
  84. ?>