Example #1
0
/**
 * Show loop on portfolio page template
 */
function duena_portfolio_show()
{
    wp_reset_query();
    global $post;
    $post_num = of_get_option('portfolio_per_page', '12');
    $post_num = intval($post_num);
    if (0 == $post_num) {
        $post_num = 12;
    }
    $args = array('posts_per_page' => $post_num, 'ignore_sticky_posts' => 1);
    $from_cat = get_post_meta($post->ID, 'duena_portfolio_meta_cats', true);
    if ('' != $from_cat && 'from_all' != $from_cat) {
        $args['cat'] = $from_cat;
    }
    $count_portf = 0;
    $item_class = 'portf_item';
    $columns = intval(get_post_meta($post->ID, 'duena_portfolio_meta_cols', true));
    if ('' == $columns || 0 == $columns) {
        $columns = 3;
    }
    switch ($columns) {
        case 2:
            $item_class .= ' col-md-6';
            break;
        case 3:
            $item_class .= ' col-md-4';
            break;
        case 4:
            $item_class .= ' col-md-3';
            break;
    }
    $portf_query = new WP_Query($args);
    if ($portf_query->have_posts()) {
        while ($portf_query->have_posts()) {
            $portf_query->the_post();
            ?>
			<div class="<?php 
            echo esc_attr($item_class);
            ?>
">
				<div class="hentry">
				<?php 
            $show_thumb = of_get_option('portfolio_show_thumbnail', 'true');
            if ('true' == $show_thumb) {
                ?>
					<figure class="featured-thumbnail thumbnail">
						<a href="<?php 
                echo get_permalink();
                ?>
">
							<?php 
                switch ($columns) {
                    case 2:
                        $thumb_size = 'portfolio-large-th';
                        break;
                    case 3:
                        $thumb_size = 'post-thumbnail';
                        break;
                    case 4:
                        $thumb_size = 'portfolio-small-th';
                        break;
                }
                the_post_thumbnail($thumb_size);
                ?>
						</a>
					</figure>
				<?php 
            }
            ?>
					<div class="post_content">
					<?php 
            $show_title = of_get_option('portfolio_show_title', 'true');
            if ('true' == $show_title) {
                ?>
						<h5>
							<a href="<?php 
                echo get_permalink();
                ?>
">
								<?php 
                the_title();
                ?>
							</a>
						</h5>
					<?php 
            }
            $show_excerpt = of_get_option('portfolio_show_excerpt', 'true');
            if ('true' == $show_excerpt) {
                ?>
						<div class="excerpt">
						<?php 
                $excerpt = get_the_excerpt();
                if (has_excerpt()) {
                    the_excerpt();
                } else {
                    echo apply_filters('the_excerpt', duena_string_limit_words($excerpt, 20));
                }
                ?>
						</div>
					<?php 
            }
            $show_link = of_get_option('portfolio_show_link', 'true');
            if ('true' == $show_link) {
                ?>
						<a href="<?php 
                the_permalink();
                ?>
" class="more_link"><?php 
                _e('Read more', 'duena');
                ?>
</a>
					<?php 
            }
            ?>
					</div>
				</div>
			</div>
			<?php 
            $count_portf++;
            $portf_num = $count_portf % $columns;
            if (0 == $portf_num) {
                ?>
				<div class="clear"></div>
				<?php 
            }
        }
    }
    wp_reset_query();
}
Example #2
0
                    ?>
                        <h4><?php 
                    the_title();
                    ?>
</h4>
                    <?php 
                }
                if ('hide' != of_get_option('sl_capt_exc') && '0' != esc_attr(of_get_option('sl_capt_exc_length'))) {
                    $exc_length = (int) esc_attr(of_get_option('sl_capt_exc_length'));
                    if ($exc_length <= 0) {
                        $exc_length = 20;
                    }
                    ?>
                    <div class="sl-capt-content"><?php 
                    $excerpt = get_the_excerpt();
                    echo duena_string_limit_words($excerpt, $exc_length);
                    ?>
</div>
                    <?php 
                }
                ?>
                    <?php 
                if ('hide' != of_get_option('sl_capt_btn')) {
                    if ('' != esc_attr(of_get_option('sl_capt_btn_txt'))) {
                        $btn_txt = esc_attr(of_get_option('sl_capt_btn_txt'));
                    } else {
                        $btn_txt = __('Read more', 'duena');
                    }
                    ?>
                    <a href="<?php 
                    the_permalink();
Example #3
0
				<?php 
if (!is_singular()) {
    ?>
				
				<!-- Post Content -->
				<div class="post_content">
					<?php 
    if ('false' != of_get_option('post_excerpt')) {
        ?>
						<div class="excerpt">
						<?php 
        $excerpt = get_the_excerpt();
        if (has_excerpt()) {
            the_excerpt();
        } else {
            echo apply_filters('the_excerpt', duena_string_limit_words($excerpt, 55));
        }
        ?>
						</div>
					<?php 
    }
    ?>
					<?php 
    if ('false' != of_get_option('post_button')) {
        $button_text = of_get_option('post_button_txt');
        if ('' == $button_text) {
            $button_text = __('Read more', 'duena');
        }
        ?>
						<a href="<?php 
        the_permalink();