Wordpress PageNavi Plugin not working in category.php

I tried different codes to be able to use the PageNavi Plugin in category.php, but all were not working. I don't know what was the problem? here is my working category.php code:

   ?php
     $cat = get_the_category();  
     $cat = $cat[0];            
     $catname = get_cat_name($cat-term_id);    
     $catid = get_cat_ID($catname);       
   ?
                  
   ?php
     $paged = get_query_var('paged', 1);
     $args = array(       
       'paged' = $paged,
       'post_type' = 'post',
       'cat' = $catid,
     );
   $query = new WP_Query($args);  
        global $query_string;
        query_posts( $query_string . posts_per_page=1paged=.$paged );
        while ( have_posts() ) : the_post()
   ?

I tried and displayed 1 post per page only, so I can see if its working. the 1 post was displayed successfully, however the PageNavi Plugin was not working.

Can anyone help me with this issue?

Topic plugin-wp-pagenavi categories Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.