Beispiel #1
0
function etheme_featured_post_shortcode($atts)
{
    $a = shortcode_atts(array('title' => '', 'id' => '', 'class' => '', 'more_posts' => 1), $atts);
    $limit = 1;
    $width = 300;
    $height = 300;
    $lightbox = etheme_get_option('blog_lightbox');
    $blog_slider = etheme_get_option('blog_slider');
    $posts_url = get_permalink(get_option('page_for_posts'));
    $args = array('p' => $a['id'], 'post_type' => 'post', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $limit);
    $the_query = new WP_Query($args);
    ob_start();
    ?>

    <?php 
    if ($the_query->have_posts()) {
        ?>

        <?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $postId = get_the_ID();
            ?>

            <div class="featured-posts <?php 
            echo $a['class'];
            ?>
">
                <?php 
            if ($a['title'] != '') {
                ?>
                    <h3 class="title a-left"><span><?php 
                echo $a['title'];
                ?>
</span></h3>
                    <?php 
                if ($a['more_posts']) {
                    ?>
                            <?php 
                    echo '<a href="' . $posts_url . '" class="show-all-posts hidden-tablet hidden-phone">' . __('View more posts', ETHEME_DOMAIN) . '</a>';
                    ?>
                    <?php 
                }
                ?>
                <?php 
            }
            ?>
                <div class="featured-post row">
                    <div class="col-md-6">
                        <?php 
            $width = etheme_get_option('blog_page_image_width');
            $height = etheme_get_option('blog_page_image_height');
            $crop = etheme_get_option('blog_page_image_cropping');
            ?>

                        <?php 
            $images = etheme_get_images($width, $height, $crop);
            ?>

                        <?php 
            if (count($images) > 0 && has_post_thumbnail()) {
                ?>
                            <div class="post-images nav-type-small<?php 
                if (count($images) > 1) {
                    ?>
 images-slider<?php 
                }
                ?>
">
                                <ul class="slides">
                                     <li><a href="<?php 
                the_permalink();
                ?>
"><img src="<?php 
                echo $images[0];
                ?>
"></a></li>
                                </ul>
                                <div class="blog-mask">
                                    <div class="mask-content">
                                        <?php 
                if ($lightbox) {
                    ?>
<a href="<?php 
                    echo etheme_get_image(get_post_thumbnail_id($postId));
                    ?>
" rel="lightbox"><i class="fa fa-resize-full"></i></a><?php 
                }
                ?>
                                        <a href="<?php 
                the_permalink();
                ?>
"><i class="fa fa-link"></i></a>
                                    </div>
                                </div>
                            </div>
                        <?php 
            }
            ?>
                    </div>
                    <div class="col-md-6">
                        <h4 class="post-title"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h4>
                        <div class="post-info">
                            <span class="posted-on">
                                <?php 
            _e('Posted on', ETHEME_DOMAIN);
            ?>
                                <?php 
            the_time(get_option('date_format'));
            ?>
 
                                <?php 
            _e('at', ETHEME_DOMAIN);
            ?>
 
                                <?php 
            the_time(get_option('time_format'));
            ?>
                            </span> 
                            <span class="posted-by"> <?php 
            _e('by', ETHEME_DOMAIN);
            ?>
 <?php 
            the_author_posts_link();
            ?>
</span>
                        </div>
                        <div class="post-description">
                            <?php 
            the_excerpt();
            ?>
                            <a href="<?php 
            the_permalink();
            ?>
" class="button read-more"><?php 
            _e('Read More', ETHEME_DOMAIN);
            ?>
</a>
                        </div>
                    </div>
                </div>
            </div>

        <?php 
        }
        ?>

        <?php 
        wp_reset_postdata();
        ?>

    <?php 
    } else {
        ?>

        <p><?php 
        _e('Sorry, no posts matched your criteria.', ETHEME_DOMAIN);
        ?>
</p>

    <?php 
    }
    ?>

    <?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Beispiel #2
0
				<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
					
					<article <?php 
        post_class('blog-post post-single');
        ?>
 id="post-<?php 
        the_ID();
        ?>
">

					<?php 
        $images = etheme_get_images(1000, 1000, false);
        ?>

					<?php 
        if (count($images) > 0 && has_post_thumbnail()) {
            ?>
						<div class="post-images nav-type-small<?php 
            if (count($images) > 1) {
                ?>
 images-slider<?php 
            }
            ?>
">
							<ul class="slides">
								<?php 
            if (!$blog_slider) {
// Display Comments
if (comments_open() && !post_password_required()) {
    echo ' / ';
    comments_popup_link('0', '1 Comment', '% Comments', 'post-comments-count');
}
?>
	</div>

	<?php 
$width = etheme_get_option('blog_page_image_width');
$height = etheme_get_option('blog_page_image_height');
$crop = etheme_get_option('blog_page_image_cropping');
?>

	<?php 
$images = etheme_get_images($width, $height, $crop);
?>

	<?php 
if (count($images) > 0 && has_post_thumbnail()) {
    ?>
		<div class="post-images nav-type-small<?php 
    if (count($images) > 1) {
        ?>
 images-slider<?php 
    }
    ?>
">
			<ul class="slides">
				<?php 
    if (!$blog_slider) {
                $imW = 870;
                break;
            case 'portrait':
                $imH = 340;
                $imW = 260;
                break;
            case 'horizontal':
                $imH = 300;
                $imW = 300;
                break;
            default:
                $blog_layout = 'default';
                $imH = 870;
                $imW = 870;
        }
        $imgUrls = etheme_get_images($imW, $imH, false);
        ?>
        
        	<div class="blog-post post-<?php 
        echo $blog_layout;
        ?>
">
        	
        		<?php 
        if ($blog_layout == 'default' || $blog_layout == 'horizontal') {
            ?>
        			<span class="post-title"><?php 
            the_title();
            ?>
</span>
	        	<?php 
    ?>
				
				        <?php 
    $blog_layout = etheme_get_option('blog_layout');
    if (etheme_get_custom_field('post_layout') && etheme_get_custom_field('post_layout') != 'global') {
        $blog_layout = etheme_get_custom_field('post_layout');
    }
    ?>
				            <div class="portfolio-single-item article">
				
					    
								<?php 
    $imW = 460;
    $imH = 460;
    $imgUrls = etheme_get_images($imW, $imH, false);
    $imgBigUrls = etheme_get_images(1000, 1000, false);
    if ($imgUrls || has_post_thumbnail()) {
        ?>
								<div class="attachments-slider nav-type-small span6">
									<ul class="slides">
										<?php 
        foreach ($imgUrls as $key => $imgUrl) {
            ?>
											<li>
												<?php 
            if (etheme_get_option('port_use_lightbox')) {
                ?>
<a href="<?php 
                echo $imgBigUrls[$key];
                ?>
" rel="lightbox[gal]"><?php