" class="blog-readmore"><?php 
    echo __('Continue Reading &raquo;', 'corbiz');
    ?>
</a>
          </div>  
          <div class="clear"></div>
        </li>
      <?php 
}
?>
      </ul>
      
      <div class="clear"></div>
      <div class="pagination">
        <?php 
theme_blog_pagenavi('', '', '', $paged);
?>
      </div>  
      
      </div>
      
      <?php 
get_sidebar();
?>
            
            
    </div>
  </div>
  
<?php 
get_footer();
function shortcode_content($atts, $content = null, $code)
{
    global $wp_filter;
    $the_content_filter_backup = $wp_filter['the_content'];
    extract(shortcode_atts(array('count' => 3, 'source' => '', 'layout' => '', 'author' => '', 'nopaging' => 'false', 'width' => '', 'height' => '', 'meta' => 'true', 'mdate' => 'true', 'mauthor' => 'true', 'mcomments' => 'true', 'mtags' => 'true', 'mcats' => 'true'), $atts));
    $instance = array('meta' => $meta, 'mdate' => $mdate, 'mauthor' => $mauthor, 'mcomments' => $mcomments, 'mtags' => $mtags, 'mcats' => $mcats);
    if (eregi('ptype-', $source)) {
        $post_type = str_replace('ptype-', '', $source);
    } elseif (eregi('cat-', $source)) {
        $post_type = 'post';
        $cat = str_replace('cat-', '', $source);
    } elseif (eregi('taxonomy-', $source)) {
        $prop = explode('|', str_replace('taxonomy-', '', $source));
        $post_type = $prop[0];
        global $wp_version;
        if (version_compare($wp_version, "3.1", '>=')) {
            $query['tax_query'] = array(array('taxonomy' => $prop[1], 'field' => 'slug', 'terms' => explode(',', $prop[2])));
        } else {
            $query['taxonomy'] = $prop[1];
            $query['term'] = $prop[2];
        }
    }
    $query = array('posts_per_page' => (int) $count, 'post_type' => $post_type);
    if ($paged) {
        $query['paged'] = $paged;
    }
    if ($cat) {
        $query['cat'] = $cat;
    }
    if ($author) {
        $query['author'] = $author;
    }
    if ($nopaging == 'false') {
        global $wp_version;
        if (is_front_page() && version_compare($wp_version, "3.1", '>=')) {
            //fix wordpress 3.1 paged query
            $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1);
        } else {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        }
        $query['paged'] = $paged;
    } else {
        $query['showposts'] = $count;
    }
    $colprops = explode('-', $layout);
    $colcount = $colprops[0];
    $gr = GW;
    switch (str_replace(' ', '', $gr)) {
        case '940':
            switch ($colcount) {
                case '1':
                    $grid = 'grid_12';
                    $cols = 1;
                    $colw = 940;
                    break;
                case '2':
                    $grid = 'grid_6';
                    $cols = 2;
                    $colw = 460;
                    break;
                case '3':
                    $grid = 'grid_4';
                    $cols = 3;
                    $colw = 300;
                    break;
                case '4':
                    $grid = 'grid_3';
                    $cols = 4;
                    $colw = 220;
                    break;
            }
            break;
        case '700':
            $maxcols = 3;
            switch ($colcount) {
                case '1':
                    $grid = 'grid_9';
                    $cols = 1;
                    $colw = 700;
                    break;
                case '2':
                    $grid = 'grid_3';
                    $cols = 3;
                    $colw = 220;
                    break;
                case '3':
                    $grid = 'grid_3';
                    $cols = 3;
                    $colw = 220;
                    break;
                case '4':
                    $grid = 'grid_3';
                    $cols = 3;
                    $colw = 220;
                    break;
            }
            break;
        case '620':
            $maxcols = 2;
            switch ($colcount) {
                case '1':
                    $grid = 'grid_8';
                    $colw = 620;
                    break;
                case '2':
                    $grid = 'grid_4';
                    $cols = 2;
                    $colw = 300;
                    break;
                case '3':
                    $grid = 'grid_4';
                    $cols = 2;
                    $colw = 300;
                    break;
                case '4':
                    $grid = 'grid_4';
                    $cols = 2;
                    $colw = 300;
                    break;
            }
            break;
        case '460':
            $maxcols = 2;
            switch ($colcount) {
                case '1':
                    $grid = 'grid_6';
                    $cols = 1;
                    break;
                case '2':
                    $grid = 'grid_3';
                    $cols = 2;
                    $colw = 220;
                    break;
                case '3':
                    $grid = 'grid_3';
                    $cols = 2;
                    $colw = 220;
                    break;
                case '4':
                    $grid = 'grid_3';
                    $cols = 2;
                    $colw = 220;
                    break;
            }
            break;
        case '300':
            $maxcols = 1;
            $cols = 1;
            switch ($colcount) {
                case '1':
                    $grid = 'grid_4';
                    $colw = 300;
                    break;
                case '2':
                    $grid = 'grid_4';
                    $colw = 300;
                    break;
                case '3':
                    $grid = 'grid_4';
                    $colw = 300;
                    break;
                case '4':
                    $grid = 'grid_4';
                    $colw = 300;
                    break;
            }
            break;
        case '220':
            $cols = 1;
            $colw = 220;
            $maxcols = 1;
            switch ($colcount) {
                case '1':
                    $grid = 'grid_3';
                    break;
                case '2':
                    $grid = 'grid_3';
                    break;
                case '3':
                    $grid = 'grid_3';
                    break;
                case '4':
                    $grid = 'grid_3';
                    break;
            }
            break;
    }
    $i = 1;
    $r = new WP_Query($query);
    if ($r->have_posts()) {
        while ($r->have_posts()) {
            $r->the_post();
            global $post;
            if ($colcount == 1 && ($colprops[2] == 'ri' || $colprops[2] == 'li' || $colprops[2] == 'gl' || $colprops[2] == 'gr')) {
                $imgw = $width;
            } else {
                $imgw = $colw;
            }
            switch ($colprops[2]) {
                case 'ri':
                    $align = 'float:right;margin-left:10px;';
                    break;
                case 'li':
                    $align = 'float:left;margin-right:10px;';
                    break;
                case 'gl':
                    $align = 'float:left;margin-right:10px;';
                    $rel = 'rel="prettyPhoto[]"';
                    $gallery = true;
                    break;
                case 'gr':
                    $align = 'float:right;margin-left:10px;';
                    $rel = 'rel="prettyPhoto[]"';
                    $gallery = true;
                    break;
                case 'g':
                    $rel = 'rel="prettyPhoto[]"';
                    $gallery = true;
                    break;
                case 'i':
                    break;
                default:
                    $noimage = true;
                    break;
            }
            if ($colcount != 1) {
                //gridd
                if ($i == 1) {
                    $gps = ' alpha';
                    $i++;
                } elseif ($i == $colcount) {
                    $gps = ' omega';
                    $i = 1;
                } else {
                    $i++;
                    $gps = '';
                }
            } else {
                $grid = '';
                $gps = '';
            }
            //gridd
            $output .= '<div class="' . $grid . $gps . ' post-' . $post->ID . '">';
            $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            $imgsrc = THEME_HELPERS . '/timthumb.php?src=' . get_image_path($img[0]) . '&amp;h=' . $height . '&amp;w=' . $imgw . '&amp;zc=1';
            $shadow = THEME_URI . '/images/image_shadow.png';
            $imgshrc = THEME_HELPERS . '/timthumb.php?src=' . get_image_path($shadow) . '&amp;w=' . $imgw . '&amp;zc=1';
            if (!$noimage) {
                $output .= '<div style="width:' . $imgw . 'px;' . $align . '">';
                if ($gallery) {
                    $video = get_post_meta($post->ID, 'videos', true);
                    if ($video) {
                        $link = $video . '&width=900&height=500';
                    } else {
                        $link = $img[0];
                    }
                }
                $output .= '<a href="';
                if ($gallery) {
                    $output .= $link;
                } else {
                    $output .= get_permalink($post->ID);
                }
                $output .= '" ' . $rel . ' class="preload"><img src="' . $imgsrc . '" style="padding:0;margin:0;line-height:0px;height:' . $height . 'px" alt="' . get_the_title($post->ID) . '" /></a>';
                $output .= '<img src="' . $imgshrc . '" style="padding:0;margin:0;line-height:0px" alt="shadow"/>';
                if ($meta == 'aimage') {
                    $output .= blog_multimeta($instance);
                }
                $output .= '</div>';
            }
            $output .= '<h2><a href="';
            if ($gallery) {
                $output .= $link;
            } else {
                $output .= get_permalink($post->ID);
            }
            $output .= '" ' . $rel . '>' . get_the_title($post->ID) . '</a></h2>';
            if ($meta == 'atitle') {
                $output .= blog_multimeta($instance);
            }
            $output .= get_the_excerpt();
            if ($meta == 'atext') {
                $output .= blog_multimeta($instance);
            }
            $output .= '</div>';
            if ($i == 1) {
                $output .= '<div style="clear:both"></div>';
            }
        }
    }
    // Loop Finito
    $output .= '<div style="clear:both"></div>';
    if ($nopaging == 'false') {
        ob_start();
        theme_blog_pagenavi('', '', $r, $paged);
        $output .= ob_get_clean();
    }
    wp_reset_postdata();
    $wp_filter['the_content'] = $the_content_filter_backup;
    return $output;
}
Exemple #3
0
function theme_shortcode_blog($atts, $content = null, $code)
{
    global $wp_filter;
    $the_content_filter_backup = $wp_filter['the_content'];
    extract(shortcode_atts(array('count' => 3, 'cat' => '', 'posts' => '', 'image' => 'true', 'meta' => 'true', 'full' => 'false', 'nopaging' => 'true', 'paged' => '', 'width' => '630'), $atts));
    $query = array('posts_per_page' => (int) $count, 'post_type' => 'post');
    if ($paged) {
        $query['paged'] = $paged;
    }
    if ($cat) {
        $query['cat'] = $cat;
    }
    if ($posts) {
        $query['post__in'] = explode(',', $posts);
    }
    if ($nopaging == 'false') {
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        $query['paged'] = $paged;
    } else {
        $query['showposts'] = $count;
    }
    if ($image == 'true') {
        $featured_image_type = theme_get_option('blog', 'featured_image_type');
    } else {
        $featured_image_type = 'full';
    }
    ob_start();
    $r = new WP_Query($query);
    if ($r->have_posts()) {
        while ($r->have_posts()) {
            $r->the_post();
            ?>
<article id="post-<?php 
            the_ID();
            ?>
" class="entry entry_<?php 
            echo $featured_image_type;
            ?>
"> 
	<?php 
            if ($image == 'true') {
                theme_generator('blog_featured_image', $featured_image_type, $width);
            }
            ?>
	<div class="entry_info">
		<h2 class="entry_title"><a href="<?php 
            echo get_permalink();
            ?>
" rel="bookmark" title="<?php 
            printf(__("Permanent Link to %s", 'striking_front'), get_the_title());
            ?>
"><?php 
            the_title();
            ?>
</a></h2>
		<?php 
            if ($meta == 'true') {
                ?>
		<div class="entry_meta">
<?php 
                theme_generator('blog_meta');
                ?>
		</div>
		<?php 
            }
            ?>
		<div class="entry_content">
<?php 
            if ($full == 'true') {
                global $more;
                $more = 0;
                the_content(__("Read More", 'striking_front'), false);
            } else {
                the_excerpt();
                ?>
			<a class="read_more_link" href="<?php 
                the_permalink();
                ?>
"><?php 
                echo __('Read more &raquo;', 'striking_front');
                ?>
</a>
<?php 
            }
            ?>
		</div>
	</div>
</article>
<?php 
        }
    }
    $output = ob_get_contents();
    ob_end_clean();
    if ($nopaging == 'false') {
        ob_start();
        theme_blog_pagenavi('', '', $r, $paged);
        $output .= ob_get_clean();
    }
    wp_reset_postdata();
    $wp_filter['the_content'] = $the_content_filter_backup;
    return '[raw]' . $output . '[/raw]';
}
function imediapixel_bloglist($cat, $num = 4, $orderby = "date", $nopaging = "false")
{
    global $id, $post, $authordata;
    $blog_cats_include = get_option('corbiz_blog_categories');
    if (is_array($blog_cats_include)) {
        $blog_include = implode(",", $blog_cats_include);
    }
    $query = array('posts_per_page' => (int) $num, 'post_type' => 'post');
    if ($cat) {
        $query['cat'] = $cat;
    } else {
        if ($blog_cats_include != "") {
            $query['cat'] = $blog_include;
        }
    }
    if ($nopaging == 'false') {
        global $wp_version;
        if ((is_front_page() || is_home()) && version_compare($wp_version, "3.1", '>=')) {
            //fix wordpress 3.1 paged query
            $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1);
        } else {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        }
        $query['paged'] = $paged;
    } else {
        $query['showposts'] = $num;
    }
    $blog_text_num = get_option('corbiz_blog_text_num') ? get_option('corbiz_blog_text_num') : 75;
    $r = new WP_Query($query);
    $out = '';
    $out .= '<ul class="bloglist">';
    while ($r->have_posts()) {
        $r->the_post();
        $out .= '<li>';
        $out .= '<div class="postimage">';
        if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
            $out .= '<div class="blog-thumb">';
            $out .= '<img src="' . get_template_directory_uri() . '/timthumb.php?src=' . thumb_url() . '&amp;h=134&amp;w=134&amp;zc=1" alt=""/>';
            $out .= '</div>';
        }
        $out .= '<div class="metapost">';
        $out .= '<span class="date">' . get_the_time(get_option('date_format')) . '</span>';
        $out .= '<span class="category">' . __('Posted on ', 'corbiz') . get_the_category_list(',') . ', ';
        $num_comments = get_comments_number();
        if ($num_comments == 0) {
            $comments = __('0 Comment');
        } elseif ($num_comments > 1) {
            $comments = $num_comments . __('Comments');
        } else {
            $comments = __('1 Comment');
        }
        $out .= '<a href="' . get_comments_link() . '">' . $comments . '</a>';
        $out .= '</span>';
        $out .= '</div>';
        $out .= '</div>';
        $out .= '<div class="postcontent">';
        $out .= '<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
        $out .= '<p>';
        if ($post->post_excerpt) {
            $out .= get_the_excerpt();
        } else {
            $out .= excerpt(90);
        }
        $out .= '</p>';
        $out .= '<a href="' . get_permalink() . '" class="blog-readmore">' . __('Continue Reading &raquo;', 'corbiz') . '</a>';
        $out .= '</div>';
        $out .= '</li>';
    }
    wp_reset_query();
    $out .= '</ul>';
    $out .= '<div class="clear"></div>';
    if ($nopaging == 'false') {
        $out .= '<div class="pagination">';
        ob_start();
        theme_blog_pagenavi('', '', $r, $paged);
        $out .= ob_get_clean();
        $out .= '</div>';
    }
    return '[raw]' . $out . '[/raw]';
}