Пример #1
0
        <div class="container">
            <h1 class="text-uppercase">Information<br /><small>最新情報</small></h1>
            <div class="row info-group">
                <?php 
$infoArgs = array('post_type' => 'info', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => '6');
$info = new WP_Query($infoArgs);
if ($info->have_posts()) {
    //$i = 0;
    while ($info->have_posts()) {
        $info->the_post();
        echo "<div class=\"info-block col-xs-12 col-md-4\">";
        echo "<a href='" . get_permalink() . "' title='" . get_the_title() . "'>";
        if (get_field("thumbnail")) {
            echo "<div class=\"info-inner\"><div class=\"image\"><div class=\"bg\" style=\"background: url(" . get_field("thumbnail") . ") center center no-repeat;\"></div></div>";
        } else {
            echo "<div class=\"info-inner\"><div class=\"image\"><div class=\"bg\" style=\"background: url(" . first_image() . ") center center no-repeat;\"></div></div>";
        }
        if (get_field("date")) {
            echo "<div class=\"date\"><p>" . get_field("date") . "</p></div>";
        }
        //echo "<p class=\"date\">".get_the_date("n/j")."</p>";
        //echo "<div class=\"caption\">";
        echo "<h2>" . get_the_title() . "</h2>";
        echo "<p class=\"excerpt\">" . get_the_excerpt() . "</p>";
        echo "<p class=\"update\">" . get_the_date("Y年n月j日") . "</p>";
        //echo "</div>";
        echo "</div></a>";
        echo "</div>";
        /*$i++;
          if (($i % 3) == 0) {
              echo "<div class='clearfix visible-md-block visible-lg-block'></div>";
Пример #2
0
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        echo $before_title . $instance['title'] . $after_title;
        ?>
		<ul id='sfpw'>
			<?php 
        global $post;
        $tmp_post = $post;
        $args = array('numberposts' => $instance['nPosts'], 'orderby' => $instance['order'], 'category' => $instance['category']);
        $myposts = get_posts($args);
        foreach ($myposts as $post) {
            setup_postdata($post);
            ?>
				<li>
					<div class="sf-image">
						<?php 
            if ($instance['image'] == 1) {
                if (has_post_thumbnail()) {
                    //<- check if the post has a Post Thumbnail assigned to it
                    $extractUrl = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail');
                    $imageUrl = $extractUrl[0];
                } else {
                    $imageUrl = first_image();
                }
                if ($instance['sizeH'] == NULL) {
                    //<- if is set just width
                    $size = imgSize(first_image());
                    if ($instance['size'] == '' or $instance['size'] == 0) {
                        $w = "150";
                    } else {
                        $w = $instance['size'];
                    }
                    $h = @ceil($size[1] / ($size[0] / $w));
                } else {
                    if ($instance['size'] == '' or $instance['size'] == 0) {
                        $w = "150";
                    } else {
                        $w = $instance['size'];
                    }
                    $h = $instance['sizeH'];
                }
                if ($instance['timthumb'] != '') {
                    //<- if is set timthumb script url
                    $imageUrl = $instance['timthumb'] . "?src=" . $imageUrl . "&amp;w=" . $w . "&amp;h=" . $h;
                }
                echo "<a href='" . get_permalink() . "' title='" . get_the_title() . "'><img width='" . $w . "' height='" . $h . "' src='" . $imageUrl . "' alt='" . the_title('', '', FALSE) . "'/></a>";
            }
            ?>
					</div>
					<div class="sf-text">
						<h3><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
						<div class="sf-date"><?php 
            if ($instance['date'] == 1) {
                ?>
<span><?php 
                the_time('j F Y');
                ?>
</span><?php 
            }
            ?>
</div>
					</div>
				</li>
			<?php 
        }
        $post = $tmp_post;
        ?>
		</ul><?php 
        wp_reset_postdata();
        echo $after_widget;
    }
Пример #3
0
                if ($tags) {
                    foreach ($tags as $tag) {
                        the_field('artistprofileimage', $tag);
                    }
                }
                ?>
"></div>
       						
    				</div>
			<?php 
            } elseif (in_category('photos')) {
                ?>
	
					<div class="archive-photos-container pointer">
       						<div data-img="<?php 
                echo first_image();
                ?>
" class="archive-photos" data-photographer="<?php 
                the_field('photographer');
                ?>
"> 
       							
       						</div>
					</div>
			<?php 
            } elseif (in_category('records')) {
                ?>
			
       					<a href="<?php 
                the_permalink();
                ?>
Пример #4
0
function get_thumbnail($width = 100, $height = 100, $class = '', $alttext = '', $titletext = '', $fullpath = false, $custom_field = '', $post = '')
{
    if ($post == '') {
        global $post;
    }
    global $shortname, $posts;
    $thumb_array['thumb'] = '';
    $thumb_array['use_timthumb'] = true;
    if ($fullpath) {
        $thumb_array['fullpath'] = '';
    }
    //full image url for lightbox
    if (function_exists('has_post_thumbnail')) {
        if (has_post_thumbnail($post->ID)) {
            $thumb_array['use_timthumb'] = false;
            $args = '';
            if ($class != '') {
                $args['class'] = $class;
            }
            if ($alttext != '') {
                $args['alt'] = $alttext;
            }
            if ($titletext != '') {
                $args['title'] = $titletext;
            }
            $thumb_array['thumb'] = get_the_post_thumbnail($post->ID, array($width, $height), $args);
            if ($fullpath) {
                $thumb_array['fullpath'] = get_the_post_thumbnail($post->ID);
                if ($thumb_array['fullpath'] != '') {
                    $thumb_array['fullpath'] = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $thumb_array['fullpath'], $matches);
                    $thumb_array['fullpath'] = trim($matches[1][0]);
                }
            }
        }
    }
    if ($thumb_array['thumb'] == '') {
        if ($custom_field == '') {
            $thumb_array['thumb'] = get_post_meta($post->ID, 'Thumbnail', $single = true);
        } else {
            $thumb_array['thumb'] = get_post_meta($post->ID, $custom_field, $single = true);
            if ($thumb_array['thumb'] == '') {
                $thumb_array['thumb'] = get_post_meta($post->ID, 'Thumbnail', $single = true);
            }
        }
        if ($thumb_array['thumb'] == '' && get_option($shortname . '_grab_image') == 'on') {
            $thumb_array['thumb'] = first_image();
        }
        #if custom field used for small pre-cropped image, open Thumbnail custom field image in lightbox
        if ($fullpath) {
            if ($custom_field == '') {
                $thumb_array['fullpath'] = apply_filters('et_fullpath', $thumb_array['thumb']);
            } elseif ($custom_field != '' && get_post_meta($post->ID, 'Thumbnail', $single = true)) {
                $thumb_array['fullpath'] = apply_filters('et_fullpath', get_post_meta($post->ID, 'Thumbnail', $single = true));
            }
        }
    }
    return $thumb_array;
}