Example #1
0
 public function render_logo($attributes = array())
 {
     $post_id = get_the_ID();
     if (!$post_id) {
         return '';
     }
     $html = '';
     $images = array('normal' => null, 'retina' => null);
     $image_classes = array();
     $esc_title = esc_attr(get_the_title());
     $thumb_id = 0;
     // get featured image
     if (has_post_thumbnail($post_id)) {
         $thumb_id = get_post_thumbnail_id($post_id);
         $images['normal'] = wp_get_attachment_image_src($thumb_id, 'full');
     }
     // get retina image
     $retina_logo_id = get_post_meta($post_id, '_dt_logo_options_retina_logo', true);
     if ($retina_logo_id) {
         $images['retina'] = dt_get_uploaded_logo(array('', $retina_logo_id[0]), 'retina');
     }
     // default image
     $default_img = null;
     foreach ($images as $image) {
         if ($image) {
             $default_img = $image;
             break;
         }
     }
     if (!$default_img) {
         return '';
     }
     if (presscore_shortcode_animation_on($attributes['animation'])) {
         $image_classes[] = presscore_get_shortcode_animation_html_class($attributes['animation']);
     }
     // ninjaaaa!
     $image_classes = implode(' ', $image_classes);
     // final image
     if (presscore_is_srcset_based_retina()) {
         $image = presscore_get_image_with_srcset($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes));
     } else {
         $image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes));
     }
     // if link not empty - wrap image with it
     $link = get_post_meta($post_id, '_dt_logo_options_link', true);
     if ($link) {
         $image_id = dt_is_hd_device() && isset($retina_logo_id[0]) ? $retina_logo_id[0] : $thumb_id;
         $esc_caption = '';
         $attachment = dt_get_attachment($image_id);
         if ($attachment) {
             $esc_caption = esc_attr($attachment['description']);
         }
         $link = esc_attr($link);
         $image = '<a href="' . $link . '" target="_blank" title="' . $esc_caption . '" >' . $image . '</a>';
     }
     // get it all togeather
     return $image;
 }
Example #2
0
 /**
  * This method render's logo item.
  *
  * @param integer $post_id If empty - uses current post id.
  *
  * @return string Item html.
  */
 public static function presscore_render_logo($post_id = null)
 {
     $post_id = $post_id ? $post_id : get_the_ID();
     if (!$post_id) {
         return '';
     }
     $html = '';
     $images = array('normal' => null, 'retina' => null);
     $esc_title = esc_attr(get_the_title());
     // get featured image
     if (has_post_thumbnail($post_id)) {
         $thumb_id = get_post_thumbnail_id($post_id);
         $images['normal'] = wp_get_attachment_image_src($thumb_id, 'full');
     }
     // get retina image
     $retina_logo_id = get_post_meta($post_id, '_dt_logo_options_retina_logo', true);
     if ($retina_logo_id) {
         $images['retina'] = dt_get_uploaded_logo(array('', $retina_logo_id[0]), 'retina');
     }
     // default image
     $default_img = null;
     foreach ($images as $image) {
         if ($image) {
             $default_img = $image;
             break;
         }
     }
     if (!$default_img) {
         return '';
     }
     // final image
     $image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"');
     // if link not empty - wrap image with it
     $link = get_post_meta($post_id, '_dt_logo_options_link', true);
     if ($link) {
         $link = esc_attr($link);
         $image = '<a href="' . $link . '" target="_blank" title="' . $esc_title . '" >' . $image . '</a>';
     }
     // get it all togeather
     return $image;
 }
Example #3
0
 /**
  * Get footer logos meta.
  *
  * @return array.
  */
 function presscore_get_floating_menu_logos_meta()
 {
     return array('logo' => dt_get_uploaded_logo(of_get_option('general-floating_menu_logo_regular', array('', 0))), 'logo_retina' => dt_get_uploaded_logo(of_get_option('general-floating_menu_logo_hd', array('', 0)), 'retina'));
 }
 /**
  * Returns the floating logos array.
  * @since 3.0.0
  * @return array
  */
 function presscore_get_floating_menu_logos_meta()
 {
     $config = presscore_config();
     if ('main' === $config->get('header.floating_navigation.logo.style')) {
         $logo = $config->get('logo.header.regular');
         $hd_logo = $config->get('logo.header.hd');
     } else {
         $logo = $config->get('logo.header.floating.regular');
         $hd_logo = $config->get('logo.header.floating.hd');
     }
     return array('logo' => dt_get_uploaded_logo($logo), 'logo_retina' => dt_get_uploaded_logo($hd_logo, 'retina'));
 }
Example #5
0
function dt_shortcode_benefits($atts)
{
    global $post;
    $temp = clone $post;
    extract(shortcode_atts(array("ppp" => 4, "title" => '', "orderby" => 'Date', "order" => 'DESC', "class" => '', "except" => '', "only" => '', "column" => 'half'), $atts));
    if ('full-width_three' == $column) {
        $column = str_replace('_three', ' third', $column);
    }
    if ('full-width_fourth' == $column) {
        $column = str_replace('_fourth', ' fourth', $column);
    }
    $output = '';
    $args = array('no_found_rows' => 1, 'post_type' => 'dt_benefits', 'post_status' => 'publish', 'orderby' => $orderby, 'order' => $order);
    if ($except || $only) {
        $cats = array_map('trim', explode(',', $except ? $except : $only));
        $args['tax_query'] = array(array('taxonomy' => 'dt_benefits_category', 'field' => 'id', 'terms' => $cats, 'operator' => 'IN'));
        if ($except) {
            $args['tax_query'][0]['oprerator'] = 'NOT IN';
        }
    }
    if ($ppp) {
        $args['posts_per_page'] = $ppp;
    }
    $query = new Wp_Query($args);
    // caching!
    if ($query->have_posts()) {
        $images = array();
        foreach ($query->posts as $p) {
            $post_meta = get_post_meta($p->ID, '_dt_benefits_options', true);
            if (!empty($post_meta['retina_image_id'])) {
                $images[] = intval($post_meta['retina_image_id']);
            }
            if (has_post_thumbnail($p->ID)) {
                $images[] = get_post_thumbnail_id($p->ID);
            }
        }
        if ($images) {
            $i_query = new WP_Query(array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'post__in' => $images));
        }
    }
    if ($query->have_posts()) {
        $output .= '<div class="' . $column . $class . '">' . "\n";
        if ($title) {
            $output .= '<h2>' . $title . '</h2>' . "\n";
        }
        $output .= '<div class="text-content">' . "\n";
        while ($query->have_posts()) {
            $query->the_post();
            $output .= '<div class="text-inline">' . "\n";
            $post_data = get_post_meta(get_the_ID(), '_dt_benefits_options', true);
            $thmb_id = get_post_thumbnail_id(get_the_ID());
            $alt = esc_attr(get_the_title());
            // fill array with images
            $images = array();
            $images['normal'] = has_post_thumbnail(get_the_ID()) ? dt_get_uploaded_logo(array('', $thmb_id)) : null;
            $images['retina'] = !empty($post_data['retina_image_id']) ? dt_get_uploaded_logo(array('', intval($post_data['retina_image_id'])), 'retina') : null;
            // calculate default image
            $default_img = null;
            foreach ($images as $image) {
                if ($image) {
                    $default_img = $image;
                    break;
                }
            }
            // if there are any image - output it
            $image = '';
            if ($default_img) {
                $image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'class="do-ico" alt="' . $alt . '"');
            }
            $output .= sprintf('<p class="head">%2$s</p><p>%1$s%3$s</p>' . "\n", $image, get_the_title(), get_the_content());
            $output .= '</div>' . "\n";
        }
        $output .= '</div>' . "\n";
        $output .= '</div>' . "\n";
    }
    $post = $temp;
    return $output;
}
Example #6
0
<?php

$logos = array('logo' => dt_get_uploaded_logo(of_get_option('branding-header_logo', array())), 'logo_retina' => dt_get_uploaded_logo(of_get_option('branding-retina_header_logo', array()), 'retina'), 'mobile' => dt_get_uploaded_logo(of_get_option('branding-header_mobile_logo', array())), 'mobile_retina' => dt_get_uploaded_logo(of_get_option('branding-retina_header_mobile_logo', array()), 'retina'));
$default_logo = null;
$alt = get_bloginfo('name');
// get default logo
foreach ($logos as $logo) {
    if ($logo) {
        $default_logo = $logo;
        break;
    }
}
?>
<header id="header">
	<div id="logo">

		<?php 
if ($default_logo) {
    $logo = dt_get_retina_sensible_image($logos['logo'], $logos['logo_retina'], $default_logo, 'id="dt-top-logo" class="dt-top-logo" alt="' . $alt . '"');
    $logo_mob = dt_get_retina_sensible_image($logos['mobile'], $logos['mobile_retina'], $default_logo, 'class="dt-top-logo-mobile" alt="' . $alt . '"');
    ?>
			
			<a href="<?php 
    echo home_url();
    ?>
" class="logo"><?php 
    echo $logo, $logo_mob;
    ?>
</a>
			
		<?php 
Example #7
0
 public function render_logo($attributes = array())
 {
     $post_id = get_the_ID();
     if (!$post_id) {
         return '';
     }
     $html = '';
     $images = array('normal' => null, 'retina' => null);
     $image_classes = array();
     $esc_title = esc_attr(get_the_title());
     $thumb_id = 0;
     // get featured image
     if (has_post_thumbnail($post_id)) {
         $thumb_id = get_post_thumbnail_id($post_id);
         $images['normal'] = wp_get_attachment_image_src($thumb_id, 'full');
     }
     // get retina image
     $retina_logo_id = get_post_meta($post_id, '_dt_logo_options_retina_logo', true);
     if ($retina_logo_id) {
         $images['retina'] = dt_get_uploaded_logo(array('', $retina_logo_id[0]), 'retina');
     }
     // default image
     $default_img = null;
     foreach ($images as $image) {
         if ($image) {
             $default_img = $image;
             break;
         }
     }
     if (!$default_img) {
         return '';
     }
     if (isset($attributes['animation']) && 'none' != $attributes['animation']) {
         switch ($attributes['animation']) {
             case 'scale':
                 $image_classes[] = 'scale-up';
                 break;
             case 'fade':
                 $image_classes[] = 'fade-in';
                 break;
             case 'left':
                 $image_classes[] = 'right-to-left';
                 break;
             case 'right':
                 $image_classes[] = 'left-to-right';
                 break;
             case 'bottom':
                 $image_classes[] = 'top-to-bottom';
                 break;
             case 'top':
                 $image_classes[] = 'bottom-to-top';
                 break;
         }
         $image_classes[] = 'animate-element';
     }
     // ninjaaaa!
     $image_classes = implode(' ', $image_classes);
     // final image
     $image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes));
     // if link not empty - wrap image with it
     $link = get_post_meta($post_id, '_dt_logo_options_link', true);
     if ($link) {
         $image_id = dt_is_hd_device() && isset($retina_logo_id[0]) ? $retina_logo_id[0] : $thumb_id;
         $esc_caption = '';
         $attachment = dt_get_attachment($image_id);
         if ($attachment) {
             $esc_caption = esc_attr($attachment['description']);
         }
         $link = esc_attr($link);
         $image = '<a href="' . $link . '" target="_blank" title="' . $esc_caption . '" >' . $image . '</a>';
     }
     // get it all togeather
     return $image;
 }
Example #8
0
        $show_bottom_line = false;
    }
}
?>

<?php 
if ($show_bottom_line) {
    ?>

<div class="line-footer"></div>
<footer id="footer">
	<div class="light"></div>

	<?php 
    dt_footer_widgetarea();
    $logos = array('logo' => dt_get_uploaded_logo(of_get_option('branding-footer_logo', array())), 'logo_retina' => dt_get_uploaded_logo(of_get_option('branding-retina_footer_logo', array()), 'retina'));
    $default_logo = null;
    $alt = get_bloginfo('name');
    // get default logo
    foreach ($logos as $logo) {
        if ($logo) {
            $default_logo = $logo;
            break;
        }
    }
    $flogo_class = '';
    if ($default_logo) {
        $flogo_class = ' class="logo-down-' . of_get_option('branding-footer_logo_position', false) . '"';
    }
    ?>
Example #9
0
    function widget($args, $instance)
    {
        extract($args);
        $instance = wp_parse_args((array) $instance, $this->dt_defaults);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        $autoslide = $instance['autoslide'];
        $autoslide_on = $autoslide ? 1 : 0;
        global $wpdb;
        $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_logos', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_logos_category', 'field' => 'id', 'terms' => $instance['cats'])));
        switch ($instance['select']) {
            case 'only':
                $args['tax_query'][0]['operator'] = 'IN';
                break;
            case 'except':
                $args['tax_query'][0]['operator'] = 'NOT IN';
                break;
            default:
                unset($args['tax_query']);
        }
        add_filter('posts_clauses', 'dt_core_join_left_filter');
        $p_query = new WP_Query($args);
        remove_filter('posts_clauses', 'dt_core_join_left_filter');
        // caching!
        if ($p_query->have_posts()) {
            $images = array();
            foreach ($p_query->posts as $logo) {
                $logos_retina = get_post_meta($logo->ID, '_dt_logos_retina', true);
                if (!empty($logos_retina['retina_image_id'])) {
                    $images[] = intval($logos_retina['retina_image_id']);
                }
                if (has_post_thumbnail($logo->ID)) {
                    $images[] = get_post_thumbnail_id($logo->ID);
                }
            }
            if ($images) {
                $i_query = new WP_Query(array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'post__in' => $images));
            }
        }
        echo $before_widget;
        // start
        echo $before_title . $title . $after_title;
        ?>
	
        <div class="partner-bg">
            <div class="list-carousel recent bx">
                <ul class="slider1" data-autoslide="<?php 
        echo $autoslide;
        ?>
" data-autoslide_on="<?php 
        echo $autoslide_on;
        ?>
">
        
        <?php 
        if ($p_query->have_posts()) {
            foreach ($p_query->posts as $logos) {
                $logos_retina = get_post_meta($logos->ID, '_dt_logos_retina', true);
                $thmb_id = get_post_thumbnail_id($logos->ID);
                $alt = esc_attr($logos->post_title);
                // fill array with images
                $images = array();
                $images['normal'] = has_post_thumbnail($logos->ID) ? dt_get_uploaded_logo(array('', $thmb_id)) : null;
                $images['retina'] = !empty($logos_retina['retina_image_id']) ? dt_get_uploaded_logo(array('', intval($logos_retina['retina_image_id'])), 'retina') : null;
                // calculate default image
                $default_img = null;
                foreach ($images as $image) {
                    if ($image) {
                        $default_img = $image;
                        break;
                    }
                }
                // if there are any image - output it
                $image = '';
                if ($default_img) {
                    $image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'alt="' . $alt . '"');
                    $logos_opts = get_post_meta($logos->ID, '_dt_logos_options', true);
                    ?>
<li><?php 
                    if (isset($logos_opts['url']) && !empty($logos_opts['url'])) {
                        $image = sprintf('<a href="%s" title="%s" target="_blank">%s</a>', esc_url($logos_opts['url']), $logos->post_title, $image);
                    }
                    echo $image;
                    ?>
</li><?php 
                }
            }
        }
        ?>

            </ul>

            </div>
	    </div>
        <?php 
        echo $after_widget;
    }