Esempio n. 1
0
 /**
  * Filter Meta Slider settings when Vantage setting is selected.
  *
  * @param $settings
  */
 function vantage_metaslider_ensure_height($settings)
 {
     if (!empty($settings['theme']) && $settings['theme'] == 'vantage') {
         $settings['width'] = vantage_get_site_width();
     }
     return $settings;
 }
 /**
  * Display the logo 
  */
 function vantage_display_logo()
 {
     $logo = siteorigin_setting('logo_image');
     $logo = apply_filters('vantage_logo_image_id', $logo);
     if (empty($logo)) {
         if (function_exists('jetpack_the_site_logo') && jetpack_has_site_logo()) {
             // We'll let Jetpack handle things
             jetpack_the_site_logo();
             return;
         }
         // Just display the site title
         $logo_html = '<h1 class="site-title">' . get_bloginfo('name') . '</h1>';
         $logo_html = apply_filters('vantage_logo_text', $logo_html);
     } else {
         // load the logo image
         if (is_array($logo)) {
             list($src, $height, $width) = $logo;
         } else {
             $image = wp_get_attachment_image_src($logo, 'full');
             $src = $image[0];
             $height = $image[2];
             $width = $image[1];
         }
         // Add all the logo attributes
         $logo_attributes = apply_filters('vantage_logo_image_attributes', array('src' => $src, 'class' => siteorigin_setting('logo_in_menu_constrain') ? 'logo-height-constrain' : 'logo-no-height-constrain', 'width' => round($width), 'height' => round($height), 'alt' => sprintf(__('%s Logo', 'vantage'), get_bloginfo('name'))));
         if ($logo_attributes['width'] > vantage_get_site_width()) {
             // Don't let the width be more than the site width.
             $width = vantage_get_site_width();
             $logo_attributes['height'] = round($logo_attributes['height'] / ($logo_attributes['width'] / $width));
             $logo_attributes['width'] = $width;
         }
         $logo_attributes_str = array();
         if (!empty($logo_attributes)) {
             foreach ($logo_attributes as $name => $val) {
                 if (empty($val)) {
                     continue;
                 }
                 $logo_attributes_str[] = $name . '="' . esc_attr($val) . '" ';
             }
         }
         $logo_html = apply_filters('vantage_logo_image', '<img ' . implode(' ', $logo_attributes_str) . ' />');
     }
     // Echo the image
     echo apply_filters('vantage_logo_html', $logo_html);
 }