I create in my wordpress theme template page named popular.php, where i sort post by popularity. It works fine for every post but I dont know how to do this for category.

I want something like this:

sitename.com/popular-post – works fine

sitename.com/category-name/popular-post – i don’t know how to make popular page child for every category?

Popular loop works fine with this args:

<?php $current_category_ID =  getCurrentCatID(); ?>
 <?php $args = array(
      'posts_per_page' => 60,
      'cat' => $current_category_ID,
      'meta_key' => 'views',
      'orderby' => 'meta_value_num',
      'order' => 'DESC',
 ); ?>

 <?php query_posts($args); ?>

Only I don’t know make it child for category?

Read more here: Child page for every category WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: