Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How can i create a navigation menu to order my videos by: WordPress


I would like to create a navigation for viewing my videos by

Most Recent
Most viewed
Top Rated
Recently viewed
Most popular
Popular tag

for the rating stars im using the Post Star Rating plugin and for the view count im using WP-PostViews

Answers (1)


Oleg Butuzov answers:

1) Most Recent
2) Most viewed
3) Top Rated
4) Recently viewed
5) Most popular
5) Popular tag
1) simple link to the home page or blog home
2) to the page with custom query loop (1)
3) rating unfortunatly stored in separate table - so you will need to customize the function or write your own.
4) to the page with custom query loop (2)
5) by using <?php echo get_tag_link( 2 ); ?> where is 2 is your id of the popular tag
here is a reference for a query loops and usage of postmeta as query loops.
<a href=""></a>

2) you will need to create a page with a custom query loop.
<?php wp_reset_query();?>
<?php query_posts('meta_key=views'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query();?>

you still qill be require to modificate quesry to your needs and use filter for query (witch is parse the SQL make order).

4) i suppose you will need to use a custom function to store revetnly viewed video posts.

something like that

Code for single post template

if (!get_option('recentvideosview')){
add_option('recentvideosview', array(), 1);

$data = get_option('recentvideosview');
array_push($data, $post->ID);
if (count($data) > 5 ){
update_option('recentvideosview', $data);

And use wp_query loop as described in article above (9th tutor), insted using sticky_posts use recentvideosview

Oleg Butuzov comments:

you also can use functionality of that plugins for your needs