示例#1
0
 /**
  *
  */
 function miss_featured_slide()
 {
     global $post, $wpdb;
     $use_featured = get_post_meta($post->ID, 'featured_featured_as_background', true);
     $background = get_post_meta($post->ID, 'featured_bg', true);
     if (isset($use_featured) && is_array($use_featured)) {
         $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
         $thumb = $thumb[0];
     } else {
         if (isset($background) && !empty($background)) {
             $thumb = $background;
         }
     }
     $imagesize = get_post_meta($post->ID, 'featured_size', true);
     $imagefullsize = get_post_meta($post->ID, 'featured_size_full_width', true);
     $banner_image = get_post_meta($post->ID, 'featured_banner_image', true);
     $banner_position = get_post_meta($post->ID, 'featured_banner_position', true);
     $banner_size = get_post_meta($post->ID, 'featured_banner_size', true) ? get_post_meta($post->ID, 'featured_banner_size', true) : array('w' => 0, 'h' => 0);
     $banner_caption_color = get_post_meta($post->ID, 'featured_caption_color', true);
     $banner_caption_font_size = get_post_meta($post->ID, 'featured_caption_font_size', true);
     $banner_content_color = get_post_meta($post->ID, 'featured_content_color', true);
     $banner_content_font_size = get_post_meta($post->ID, 'featured_content_font_size', true);
     // Define background color
     $bg_color = get_post_meta($post->ID, 'featured_bg_color', true);
     if (isset($bg_color) && !empty($bg_color)) {
         $bg_color = 'background-color:#red;';
     } else {
         $bg_color = '';
     }
     // Define caption
     $caption = get_post_meta($post->ID, 'featured_caption', true);
     if (isset($caption) && !empty($caption)) {
         $caption = '<h2 style="color:' . $banner_caption_color . '; font-size:' . $banner_caption_font_size . ';">' . $caption . '</h2>';
     } else {
         $caption = '';
     }
     // Define button
     $button_caption = get_post_meta($post->ID, 'featured_button_caption', true);
     $button_link = get_post_meta($post->ID, 'featured_button_link', true);
     $button_disable = get_post_meta($post->ID, 'featured_disable_button', true);
     $button_disable = is_array($button_disable) ? implode('', $button_disable) : '';
     if (isset($button_caption) && !empty($button_caption) && $button_disable != 'true') {
         $button = '<div class="btn_wrap"><a href="' . $button_disable . $button_link . '" class="btn2">' . $button_caption . '</a></div>';
     } else {
         $button = '';
     }
     // Define content
     $content = get_post_meta($post->ID, 'featured_content', true);
     if (isset($content) && !empty($content)) {
         $content = '<p style="color:' . $banner_content_color . ';font-size:' . $banner_content_font_size . ';">' . $content . '</p>';
     } else {
         $content = '';
     }
     $banner_disabled = get_post_meta($post->ID, 'featured_banner_disabled', true);
     $banner_disabled = isset($banner_disabled[0]) ? $banner_disabled[0] : false;
     $banner_style = ' style="';
     if ($banner_position == 'center') {
         $banner_style .= 'position: relative;margin:auto;float:none;';
     } else {
         $banner_style .= 'position: absolute;top:50%;float:' . $banner_position . ';margin-top:-' . $banner_size['h'] / 2 . 'px;';
         if ($banner_position == 'left') {
             $banner_style .= 'left:0;';
         } else {
             $banner_style .= 'right:0;';
         }
     }
     $banner_style .= 'width:' . $banner_size['w'] . 'px;height:' . $banner_size['h'] . 'px;';
     $banner_style .= '"';
     if (!isset($imagesize) || !is_array($imagesize)) {
         $_width = 2200;
         $_height = 388;
     } else {
         $_width = empty($imagefullsize[0]) ? $imagesize['w'] : '9999';
         $_height = $imagesize['h'];
     }
     if (isset($thumb)) {
         $thumb = miss_wp_image($thumb, $_width, $_height);
         $image = miss_image_signature($thumb);
         $thumb = 'background-image:url(' . $thumb . ');';
     } else {
         $thumb = '';
     }
     //$out .= '<img src="' . $thumb . '" alt="" />';
     $out = '';
     $out .= '<div class="relative" style="' . $bg_color . $thumb . 'background-repeat:no-repeat; background-position:top center; height:' . $_height . 'px; ">';
     if ($banner_disabled != 'true') {
         $out .= '<div class="container relative" style="height:' . $_height . 'px"><div class="row" style="height:' . $_height . 'px"><div class="span12" style="height:' . $_height . 'px"><div class="miss_billboard"' . $banner_style . '>' . $caption . $content . $button . '</div></div></div></div>';
     }
     $out .= '</div>';
     return $out;
 }
示例#2
0
    $query->query('post_type=portfolio&posts_per_page=6');
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $site = get_post_custom_values('project_Link');
            $shortDesc = get_post_custom_values('project_Desc');
            $project_image1 = get_post_custom_values('project_image1');
            ?>
          <li>
            <div class="entry has_preview">
              <?php 
            if (has_post_thumbnail()) {
                $work_preview = true;
                $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'medium');
                $thumb = miss_wp_image($thumb[0], 518, 338);
                $image = miss_image_signature($thumb);
                echo miss_render_link_container($image['link'], miss_render_image_container($image['img']));
                ?>


              <div class="work-description">
                <?php 
                $categories = strip_tags(get_the_term_list(get_the_ID(), 'portfolio_category', '', ', ', ''));
                ?>
                <h4><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a><span><?php