Dude, You can do lot of things for that. If I am in your seat i will do like this.
Here is the code. In this I used category slug you can use the id also.
In your function.php file add this
/*------------------------------------------*/
/** [media] shortcode function - by Yesh **/
/*------------------------------------------*/
function mediaShortcode($atts) {
//Extract Shotcode from the pages and posts
extract(shortcode_atts(array('slug' => 'default'), $atts));
global $post;
$args = array( 'numberposts' => 5, 'category_name' => $atts['slug'], 'orderby' => 'post_date', 'order' => 'DESC');
//print_r($args);
$posts = get_posts( $args );
//print_r($posts);
$html="";
foreach ($posts as $post) {
$html.='<article class="left-container-video">';
$html.='<header class="video-header">';
$html.='<a href="'.$post->guid.'"><h1>'.$post->post_title.'<h1></a>';
$html.='</header>';
$html.='<div class="video-container">';
$html.=$post->post_content;
$html.='</div><!-- end vid container -->';
$html.='</article>';
//$html.=do_shortcode($post->post_content);
}
return $html;
}
add_shortcode('media', 'mediaShortcode');
in your template.php
<?php
/*
Template Name: Media page Template
*/
?>
<?php get_header(); ?>
<div class="wrapper-small">
<div style="" id="media-page">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<!-- <div class="navigation">
<div class="next-posts"><?php next_posts_link(); ?></div>
<div class="prev-posts"><?php previous_posts_link(); ?></div>
</div> -->
<?php else : ?>
<h1>Not Found</h1>
<?php endif; ?>
</div>
</div><!-- end wrapper -->
<?php get_footer(); ?>
and now, as my function. I have to add in the page [media slug="video-category"].
Select page template as Media Page template. Thenpublish. If you want to show more category posts. Just add after the first line your next category slug.[media slug="video-gallery]`.
This will show the rest of posts in your gallery. You have to select the theme only. You can use this in any page.
For more information refer these articles.
If you need my help. Please find me any of social network by searching yeshansachithak.