PHP 36
CSS im Footer laden (fontawesome) By micha on 6th February 2019 04:04:50 PM
  1. function load_styles()
  2.   {
  3.     $path = get_template_directory_uri();
  4.     $styles = array(
  5.       'font-awesome' => array(
  6.         'url'         => 'https://use.fontawesome.com/releases/v5.7.1/css/all.css',
  7.         'media'       => 'all',
  8.         'integrity'   => 'sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr',
  9.         'crossorigin' => 'anonymous'
  10.       ),
  11.       'dashicons' => array(
  12.         'url'   => includes_url().'css/dashicons.min.css',
  13.         'media' => 'all'
  14.       ),
  15.       'fonts' => array(
  16.         'url'   => 'https://fonts.googleapis.com/css?family=Playfair+Display:400,700|Roboto:300,400,700',
  17.         'media' => 'all'
  18.       ),
  19.       'swiper' => array(
  20.         'url'   => 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.3.1/css/swiper.min.css',
  21.         'media' => 'all'
  22.       ),
  23.       'fancybox' => array(
  24.         'url'   => 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.min.css',
  25.         'media' => 'all'
  26.       ),
  27.       'mobile' => array(
  28.         'url'   => $path.'/css/mobile.min.css',
  29.         'media' => 'screen and (max-width: 767px)'
  30.       ),
  31.       'tablet' => array(
  32.         'url'   => $path.'/css/tablet.min.css',
  33.         'media' => 'screen and (min-width: 768px) and (max-width: 1024px)'
  34.       ),
  35.       'desktop' => array(
  36.         'url'   => $path.'/css/desktop.min.css',
  37.         'media' => 'screen and (min-width: 1025px)'
  38.       ),
  39.       'print' => array(
  40.         'url'   => $path.'/css/print.min.css',
  41.         'media' => 'print'
  42.       )
  43.     );
  44.     foreach ($styles as $style)
  45.     {
  46.       echo '
  47.      <link rel="stylesheet" href="'.$style['url'].'"
  48.       ' . (!empty($style['integrity']) ? ' integrity="'.$style['integrity'].'"' : '') . '
  49.       ' . (!empty($style['crossorigin']) ? ' crossorigin="'.$style['crossorigin'].'"' : '') . '
  50.       media="'.$style['media'].'">
  51.       ';
  52.     }
  53.   }

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.