示例#1
0
				<div class="blogdate"><?php 
        echo get_the_time($dataformat);
        ?>
</div>
				<?php 
    }
    ?>
				<?php 
    if ($metaformat != 'none') {
        ?>
				<div class="meta-links">
					<?php 
        if (strpos($metaformat, 'posted') !== false) {
            ?>
					<a class="meta-author" href="javascript:void(0);" rel="<?php 
            posted_on_template();
            ?>
"></a>
					<?php 
        }
        ?>
					
					<?php 
        if (strpos($metaformat, 'comments') !== false) {
            ?>
						<a class="meta-comments" href="javascript:void(0);" rel="<?php 
            comments_number(__('No Comment', 'rb'), __('1 Comment', 'rb'), __('% Comments', 'rb'));
            ?>
"></a>
					<?php 
        }
示例#2
0
function sh_blog($attr, $content = null)
{
    global $paged, $wpdb, $more, $blogparams, $pageTitle;
    $blogparams = $attr;
    $cats = '';
    $postperpage = 10;
    $directlink = true;
    if ($blogparams['directlink'] == 'true') {
        $directlink = true;
    }
    if (!empty($blogparams['postperpage'])) {
        $postperpage = $blogparams['postperpage'];
    }
    if (!empty($blogparams['cats'])) {
        $cats = $blogparams['cats'];
    }
    $dataformat = 'd.m.Y';
    $metaformat = 'posted, comments, tag';
    $useImage = true;
    if (!empty($blogparams['dateformat'])) {
        $dataformat = $blogparams['dateformat'];
    }
    if (!empty($blogparams['metaformat'])) {
        $metaformat = $blogparams['metaformat'];
    }
    $imageW = $imgW = 350;
    $imageH = $imgH = 225;
    wp_reset_postdata();
    $the_query_arr = 'post_type=post&posts_per_page=' . $postperpage . '&cat=' . $cats . '&paged=' . $paged;
    $the_query = new WP_Query($the_query_arr);
    $re = '';
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $sourceData = get_post_meta(get_the_ID(), "sourceData", true);
        $sourceOpen = get_post_meta(get_the_ID(), "sourceOpen", true);
        $useResizer = get_post_meta(get_the_ID(), "useResizer", true);
        $cropPos = get_post_meta(get_the_ID(), "cropPos", true);
        $cropPos = $cropPos == '' ? 'c' : $cropPos;
        $sourceType = getMediaType($sourceData);
        $sourceStr = getSource($sourceData, $imgW, $imgH);
        $blogClass = '';
        $blogClassArr = get_post_class(array('blogitem'), get_the_ID());
        foreach ($blogClassArr as $blogClassArrItem) {
            $blogClass .= $blogClassArrItem . ' ';
        }
        $re .= '<div id="post-' . get_the_ID() . '" class="' . $blogClass . '">
		<h3>' . get_the_title() . '</h3>';
        if (has_post_thumbnail() || !empty($sourceStr) && $sourceOpen == 'e') {
            $thumbnail_src = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()));
            if ($useResizer == 'use') {
                $thumbnail_url = get_template_directory_uri() . '/includes/timthumb.php?src=' . $thumbnail_src . '&h=' . $imageH . '&w=' . $imageW . '&zc=1&a=' . $cropPos . '&q=100';
            } else {
                $thumbnail_url = $thumbnail_src;
            }
            $useImage = true;
            $re .= '<div class="blogimage">
			<div class="image_frame">';
            if ($sourceOpen == 'm' || empty($sourceOpen) || empty($sourceData)) {
                if (!$directlink) {
                    $re .= '<a href="' . (empty($sourceData) ? $thumbnail_src : $sourceData) . '" title="' . get_the_title() . '">';
                } else {
                    $re .= '<a href="#!' . get_ajax_permalink() . '" title="' . get_the_title() . '">';
                }
                $re .= '<img ' . ($directlink ? 'class="nomodal"' : '') . ' src="' . $thumbnail_url . '" width="' . $imgW . '" height="' . $imgH . '" alt="' . get_the_title() . '" />

					<div class="hoverWrapperBg"></div>
					<div class="hoverWrapper">
						<span class="link" rel="#!' . get_ajax_permalink() . '"></span>';
                if (!$directlink) {
                    $modalClass = 'modal';
                    if ($sourceType == 'vimeo' || $sourceType == 'youtube' || $sourceType == 'jwplayer') {
                        $modalClass = 'modalVideo';
                    }
                    $re .= '<span class="' . $modalClass . '"></span>';
                }
                $re .= '</div>';
                $re .= '</a>';
            } elseif ($sourceOpen == 'e') {
                $re .= '<div style="position: relative; width:' . $imageW . 'px; height:' . $imageH . 'px; background-image: none; opacity: 1;">
					' . $sourceStr . '
				</div>';
            }
            $re .= '</div>
		</div>';
        } else {
            $useImage = false;
        }
        $re .= '<div class="blogcontent" ' . (!$useImage ? 'style="width:600px; margin-left:0"' : '') . '>
			<div class="blogdatemeta">';
        if ($dataformat != 'none') {
            $re .= '<div class="blogdate">' . get_the_time($dataformat) . '</div>';
        }
        if ($metaformat != 'none') {
            $re .= '<div class="meta-links">';
            if (strpos($metaformat, 'posted') !== false) {
                $re .= '<a class="meta-author" href="javascript:void(0);" rel="' . posted_on_template() . '"></a>';
            }
            if (strpos($metaformat, 'comments') !== false) {
                $commentCount = get_comments_number(get_the_ID());
                if ($commentCount == 0) {
                    $commentStr = __('No Comment', 'rb');
                } elseif ($commentCount == 1) {
                    $commentStr = __('1 Comment', 'rb');
                } else {
                    $commentStr = $commentCount . __('Comments', 'rb');
                }
                $re .= '<a class="meta-comments" href="javascript:void(0);" rel="' . $commentStr . '"></a>';
            }
            if (strpos($metaformat, 'tag') !== false) {
                $tags_list = wp_get_post_tags(get_the_ID(), array('fields' => 'names'));
                if ($tags_list) {
                    $re .= '<a class="meta-tags" href="javascript:void(0);" rel="' . implode(' ,', $tags_list) . '"></a>';
                }
            }
            $re .= '</div>';
        }
        $re .= '</div> 
			<p>';
        $more = 0;
        $re .= get_the_content('') . '
			</p>
			<a class="morelink" href="#!' . get_ajax_permalink() . '">' . __('READ MORE', 'rb') . '</a>
		</div>
		<hr class="seperator"/>
		<div class="clearfix"></div>
	</div>';
    }
    if (function_exists('wp_pagenavi')) {
        $re .= wp_pagenavi(array('query' => $the_query, 'options' => array('return_string' => true)));
    }
    wp_reset_postdata();
    $re .= '
	<div class="divider" style="height:10px"></div>
	<div class="clearfix"></div>';
    return $re;
}