blog Shortcode extended to serve TAGS

BLOG Shortcode in BETHEME does not support TAG, only CATEGORY to select blog

here is the extension, just use 

[*blog count="2" tag=""  tag_id="" category="" style="modern" columns="" filters="0" greyscale="0" more="1" pagination="0"]

/clickandbuilds/Homeopathy/wp-content/themes/betheme/functions

file theme-shortcodes.php, search for BLOG = line 885


/* ---------------------------------------------------------------------------
* Blog [blog]
* --------------------------------------------------------------------------- */
if( ! function_exists( 'sc_blog' ) )
{
function sc_blog( $attr, $content = null )
{
extract(shortcode_atts(array(
'count' => 2,
'category' => '',
'category_multi' => '',
'exclude_id' => '',
'style' => 'classic',
'columns' => 3,
'greyscale' => '',
'more' => '',
'filters' => '',
'pagination' => '',
'load_more' => '',
'tag' =>'',
'tag_id' =>'',
), $attr));

$translate['filter'] = mfn_opts_get('translate') ? mfn_opts_get('translate-filter','Filter by') : __('Filter by','betheme');
$translate['tags'] = mfn_opts_get('translate') ? mfn_opts_get('translate-tags','Tags') : __('Tags','betheme');
$translate['authors'] = mfn_opts_get('translate') ? mfn_opts_get('translate-authors','Authors') : __('Authors','betheme');
$translate['all'] = mfn_opts_get('translate') ? mfn_opts_get('translate-item-all','All') : __('All','betheme');
$translate['categories'] = mfn_opts_get('translate') ? mfn_opts_get('translate-categories','Categories') : __('Categories','betheme');


$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : ( ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 );
$args = array(
'posts_per_page' => intval($count),
'paged' => $paged,
'post_status' => 'publish',
'ignore_sticky_posts' => 0,
);

// private
if( is_user_logged_in() ){
$args['post_status'] = array('publish','private');
}

// categories
if( $category_multi ){
$args['category_name'] = trim( $category_multi );
} elseif( $category ){
$args['category_name'] = $category;
}


// tag
if( $tag ){
$args['tag'] = trim( $tag );
}

// tag_id
if( $tag_id ){
$args['tag_id'] = trim( $tag_id );
}


// exclude posts
if( $exclude_id ){
$exclude_id = str_replace( ' ', '', $exclude_id );
$args['post__not_in'] = explode( ',', $exclude_id );
}

......

Comments

Sign In or Register to comment.