functions.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Ibis functions and definitions
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  6. *
  7. * @package WordPress
  8. * @subpackage seedlet_blocks
  9. * @since 1.0.0
  10. */
  11. if ( ! function_exists( 'ibis_setup' ) ) :
  12. /**
  13. * Sets up theme defaults and registers support for various WordPress features.
  14. *
  15. * Note that this function is hooked into the after_setup_theme hook, which
  16. * runs before the init hook. The init hook is too late for some features, such
  17. * as indicating support for post thumbnails.
  18. */
  19. function ibis_setup() {
  20. // Add support for editor styles.
  21. add_theme_support( 'editor-styles' );
  22. // Enqueue editor styles.
  23. add_editor_style( get_stylesheet_directory_uri() . '/style-editor.css' );
  24. }
  25. endif;
  26. add_action( 'after_setup_theme', 'ibis_setup', 999 );
  27. /**
  28. * Add Google webfonts
  29. *
  30. * http://themeshaper.com/2014/08/13/how-to-add-google-fonts-to-wordpress-themes/
  31. */
  32. function ibis_fonts_url() {
  33. $fonts_url = '';
  34. /* Translators: If there are characters in your language that are not
  35. * supported by Lora, translate this to 'off'. Do not translate
  36. * into your own language.
  37. */
  38. $lora = esc_html_x( 'on', 'Lora font: on or off', 'ibis' );
  39. if ( 'off' !== $lora ) {
  40. $font_families = array();
  41. $font_families[] = 'Lora:400,400i,600,600i,700,700i';
  42. /**
  43. * A filter to enable child themes to add/change/omit font families.
  44. *
  45. * @param array $font_families An array of font families to be imploded for the Google Font API
  46. */
  47. $font_families = apply_filters( 'included_google_font_families', $font_families );
  48. $query_args = array(
  49. 'family' => urlencode( implode( '|', $font_families ) ),
  50. 'subset' => urlencode( 'latin,latin-ext' ),
  51. );
  52. $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
  53. }
  54. return esc_url_raw( $fonts_url );
  55. }
  56. /**
  57. * Enqueue scripts and styles.
  58. */
  59. function ibis_enqueue() {
  60. wp_enqueue_style( 'ibis-styles', get_stylesheet_uri() );
  61. // enqueue Google fonts
  62. wp_enqueue_style( 'mayland-fonts', ibis_fonts_url(), array(), null );
  63. }
  64. add_action( 'wp_enqueue_scripts', 'ibis_enqueue' );