Accordian Slider with Custom Post

function tiptrick_shortcode($atts, $content){
extract (shortcode_atts( array( ‘posts’ => 4, ‘category_slug’ => “tipstricks-default-category”,

), $atts ));
global $post;

$args=array( ‘post_type’=>’tiptrick’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => $posts, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘caller_get_posts’=> 1, ‘tiptrick_cat’=> $category_slug,
‘tax_query’ => array(
‘taxonomy’ => ‘tiptrick_cat’,
‘field’    => ‘slug’,
‘terms’    => array($category_slug),
)
);
$catObj = get_term_by(‘slug’, $category_slug, ‘tiptrick_cat’);
$catName = $catObj->name;
$posts = new WP_Query($args);
$output = ”;

$output.='<section class=”horizontalaccordian”>

‘.$catName.’ …View More >>

‘;
$output.=’

‘;
$var='{“active”: 2,”responsive”: true,”orientation”: “horizontal”,  “theme”: “silver”, “shadows”: true,”bordered”: true, “slider”: true, “rounded”: false, “width”: 1600, “height”:600, “dotNav”:true, “containerHeight”: 320, “headerSize”:68, “animation”: {“duration”:3200, “easing”: “easeInOutQuart”}, “showIcons”: true,”headerFontSize”: 1.6, “autoplay”: {“interval”:6000}}’;

$output.=”

“;
$i=1;

while ($posts->have_posts()): $posts->the_post();
$thumbnail = get_the_post_thumbnail($post->ID);

$output.=’

‘.get_the_title().’

‘.get_the_title().’

‘. $thumbnail.’

‘.get_the_excerpt().’See More >>

</div>
</div>
</section>’;

$i++;
endwhile;
$output.='</article>
</div>
</div>
</div>
</div>
</div>

</section>’;

wp_reset_query();
return html_entity_decode($output);
}
add_shortcode( ‘tiptrick’, ‘tiptrick_shortcode’ );

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: