Guest User

Untitled

a guest
Jun 25th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. <?php
  2. global $google_webfonts;
  3. $google_webfonts = array('Abel','Aclonica','Actor','Aldrich','Alice','Allan:bold','Allerta','Allerta+Stencil','Amaranth','Andika','Annie+Use+Your+Telescope','Anonymous+Pro','Anton','Architects+Daughter','Arimo','Artifika','Arvo','Asset','Astloch','Aubrey','Bangers','Bentham','Bevan','Bigshot+One','Black+Ops+One','Bowlby+One','Bowlby+One+SC','Brawler','Buda:light','Cabin','Cabin+Sketch:bold','Cabin:bold','Calligraffitti','Candal','Cantarell','Cardo','Carme','Carter+One','Caudex','Cedarville+Cursive','Cherry+Cream+Soda','Chewy','Coda:800','Comfortaa','Coming+Soon','Copse','Corben:bold','Cousine','Coustard','Covered+By+Your+Grace','Crafty+Girls','Crimson','Crushed','Cuprum','Damion','Dancing+Script','Dawning+of+a+New+Day','Days+One','Delius','Delius+Swash+Caps','Didact+Gothic','Droid Sans','Droid Sans Mono','Droid Serif','EB+Garamond','Expletus+Sans','Federo','Fontdiner+Swanky','Forum','Francois+One','Gentium+Basic','Gentium+Book+Basic','Geo','Geostar','Geostar+Fill','Give+You+Glory','Gloria+Hallelujah','Goblin+One','Goudy+Bookletter+1911','Gravitas+One','Gruppo','Hammersmith+One','Holtwood+One+SC','Homemade+Apple','IM Fell','Inconsolata','Indie+Flower','Irish+Growler','Istok+Web','Josefin Sans Std Light','Josefin+Sans','Josefin+Slab','Judson','Jura','Just+Another+Hand','Just+Me+Again+Down+Here','Kameron','Kelly+Slab','Kenia','Kranky','Kreon','Kristi','La+Belle+Aurore','Lato','League+Script','Leckerli+One','Lekton','Limelight','Lobster','Lobster+Two','Lora','Love+Ya+Like+A+Sister','Loved+by+the+King','Luckiest+Guy','Maiden+Orange','Mako','Marvel','Maven+Pro','Meddon','MedievalSharp','Megrim','Merriweather','Metrophobic','Michroma','Miltonian','Miltonian+Tattoo','Modern+Antiqua','Molengo','Monofett','Montez','Mountains+of+Christmas','Muli','Neucha','Neuton','News+Cycle','Nixie+One','Nobile','Nova+Round','Numans','Nunito','OFL Sorts Mill Goudy TT','OFL Standard TT','Orbitron','Oswald','Over+the+Rainbow','Ovo','PT Sans','PT Sans Narrow','PT+Serif','PT+Serif+Caption','Pacifico','Patrick+Hand','Paytone+One','Permanent+Marker','Philosopher','Play','Playfair+Display','Podkova','Pompiere','Puritan','Quattrocento','Quattrocento+Sans','Questrial','Radley','Raleway:100','Rationale','Redressed','Reenie Beanie','Rochester','Rock+Salt','Rokkitt','Rosario','Ruslan+Display','Schoolbell','Shadows+Into+Light','Shanti','Short+Stack','Sigmar+One','Six+Caps','Slackey','Smokum','Smythe','Sniglet:800','Snippet','Special+Elite','Stardos+Stencil','Sue+Ellen+Francisco','Sunshiney','Swanky+and+Moo+Moo','Syncopate','Tangerine','Tenor+Sans','Terminal+Dosis+Light','The+Girl+Next+Door','Tienne','Tinos','Tulpen+One','Ubuntu','Ultra','UnifrakturCook:bold','UnifrakturMaguntia','Unkempt','Unna','VT323','Varela','Varela+Round','Vibur','Vidaloka','Volkhov','Vollkorn','Voltaire','Waiting+for+the+Sunrise','Wallpoet','Walter+Turncoat','Wire+One','Yanone Kaffeesatz','Yellowtail','Yeseva+One','Zeyada');
  4. $google_webfonts = str_replace('+', ' ', $google_webfonts);
  5.  
  6. add_action( 'admin_menu', 'producthelp_admin_setup' );
  7.  
  8. function producthelp_admin_setup() {
  9.  
  10. /* Get the theme prefix. */
  11. $prefix = hybrid_get_prefix();
  12.  
  13. /* Create a settings meta box only on the theme settings page. */
  14. add_action( 'load-appearance_page_theme-settings', 'producthelp_settings_meta_boxes' );
  15.  
  16. /* Add a filter to validate/sanitize your settings. */
  17. add_filter( "sanitize_option_{$prefix}_theme_settings", 'producthelp_validate_settings' );
  18. }
  19.  
  20. /* Adds custom meta boxes to the theme settings page. */
  21. function producthelp_settings_meta_boxes() {
  22.  
  23. /* Add a custom meta box. */
  24. add_meta_box(
  25. 'example-theme-meta-box', // Name/ID
  26. __( 'Example Settings', hybrid_get_textdomain() ), // Label
  27. 'producthelp_meta_box', // Callback function
  28. 'appearance_page_theme-settings', // Page to load on, leave as is
  29. 'normal', // Which meta box holder?
  30. 'high' // High/low within the meta box holder
  31. );
  32.  
  33. /* Add additional add_meta_box() calls here. */
  34. }
  35.  
  36. /* Function for displaying the meta box. */
  37. function producthelp_meta_box() { ?>
  38.  
  39.  
  40. <th><label for="font_family"><?php _e( 'Style:', hybrid_get_textdomain() ); ?></label></th>
  41. <td>
  42. <select name="<?php echo hybrid_settings_field_name( 'font_family' ) ; ?>" id="<?php echo hybrid_settings_field_id( 'font_family' ) ; ?>">
  43. <?php
  44. global $google_webfonts;
  45.  
  46.  
  47. foreach ($google_webfonts as $web_font_name) {
  48. echo '<option value="'.$web_font_name.'" "<?php selected( .$web_font_name., hybrid_get_setting( "font_family" )); ?>" > '.$web_font_name.'</option>';
  49.  
  50. }
  51.  
  52. ?>
  53.  
  54. <option value="1" <?php selected( 1, hybrid_get_setting( 'theme_color' )); ?>>1</option>
  55.  
  56. </select><br/>
  57. <label for="<?php echo hybrid_settings_field_id( 'font_family' ) ; ?>"><?php _e( 'Choose the color theme you want.', hybrid_get_textdomain() ); ?></label><br />
  58. </td>
  59. </tr>
  60. </table><!-- .form-table -->
  61.  
  62. <?php
  63. }
  64.  
  65. /* Validates theme settings. */
  66. function producthelp_validate_settings( $input ) {
  67.  
  68.  
  69.  
  70. $input['theme_color'] = wp_filter_nohtml_kses( $input['theme_color'] );
  71. $input['font_family'] = wp_filter_nohtml_kses( $input['font_family'] );
  72.  
  73.  
  74. /* Return the array of theme settings. */
  75. return $input;
  76. }
  77.  
  78. ?>
Add Comment
Please, Sign In to add comment