Title: Feature Request
Last modified: June 4, 2023

---

# Feature Request

 *  Resolved [Morshed Alam](https://wordpress.org/support/users/sumon1068/)
 * (@sumon1068)
 * [3 years ago](https://wordpress.org/support/topic/feature-request-989/)
 * Hello,
 * This is actually a feature request. I have been using your plugin by modifying
   it a little bit.
 * Here’s what I am using:
 *     ```wp-block-code
       $original_template = plugin_dir_path(__FILE__) . "includes/main.php";
       $override_template = get_stylesheet_directory() . "/includes/main.php";
       if(file_exists($override_template)){include( $override_template );}
       else{include( $original_template );}
       //require_once POP_AUTHOR_PLUGIN_DIR . 'includes/main.php';
       ```
   
 * I did this to customize the output. I don’t know what it is called. Maybe creating**
   Custom Template** or something. Many modern plugins are allowing this.
 * So my request to you that please add above code to your plugin so that every 
   time the plugin gets an update we won’t have to modify the file.
 * Thank you.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffeature-request-989%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [3 years ago](https://wordpress.org/support/topic/feature-request-989/#post-16810320)
 * [@sumon1068](https://wordpress.org/support/users/sumon1068/)
 * Happy to include this. Where exactly are you modifying the plugin. And, if you
   are on Github, it might be easier to send a PR?
 *  Thread Starter [Morshed Alam](https://wordpress.org/support/users/sumon1068/)
 * (@sumon1068)
 * [3 years ago](https://wordpress.org/support/topic/feature-request-989/#post-16810460)
 * I am modifying `popular-authors.php` file, the modules section.
 * And sorry, I don’t use Github.
 * Thank you for considering.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/feature-request-989/#post-16819625)
 * I’ve filed this in Github for implementation – [https://github.com/WebberZone/popular-authors/issues/13](https://github.com/WebberZone/popular-authors/issues/13)
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/feature-request-989/#post-16957161)
 * [@sumon1068](https://wordpress.org/support/users/sumon1068/)
 * I wanted to update you that I have implemented a custom template feature. Note
   that it doesn’t work as you’ve done above but a relatively cleaner approach.
 * Sample code below on how to override using the [new filter](https://github.com/WebberZone/popular-authors/commit/55288457ad92b9b54d4127d1b6c1defa8bee1729).
   You can use from the main.php you created.
 *     ```wp-block-code
       function override_wzpa_custom_template( $template, $authors, $args, $post_counts ) {
       	$output = '';
       	foreach ( $authors as $author ) {
       		$author_id   = $author->author_id;
       		$views       = $author->visits;
       		$no_of_posts = isset( $post_counts[ $author_id ] ) ? $post_counts[ $author_id ] : 0;
       		$output     .= "HTML for the template: $author_id | $views | $no_of_posts \n";
       	}
       	return $output;
       }
       add_filter( 'wzpa_custom_template', 'override_wzpa_custom_template', 99, 4 );
       ```
   
 *  Thread Starter [Morshed Alam](https://wordpress.org/support/users/sumon1068/)
 * (@sumon1068)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/feature-request-989/#post-16982573)
 * [@ajay](https://wordpress.org/support/users/ajay/)
 * Happy to see the custom template feature you’ve added. It’s working fine for 
   me.
 * But there has another problem risen. Remember [this thread](https://wordpress.org/support/topic/popular-authors-by-post-views-only/)?
 * It’s including custom post type counts again. As previously I was using edited
   main.php, I added this line:
 *     ```wp-block-code
       $where .= " AND {$posts_table}.post_type = ‘post’ “;
       ```
   
 * Now there is no main.php and I don’t want to edit the plugin.
 * So, here is the dillema: I want counter enabled for custom post type (as I need
   to know which custom post type post is getting viewer’s attention), but I want
   to show popular authors based on Post views only, no custom post views added.
 * Please add a **Popular Authors** menu in the dashboard to let choose whether 
   we want to add custom post type views or not.
 * Thank you.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/feature-request-989/#post-16982863)
 * [@sumon1068](https://wordpress.org/support/users/sumon1068/)
 * I have this filed as a future feature in v1.3.0
 * [https://github.com/WebberZone/popular-authors/issues/10](https://github.com/WebberZone/popular-authors/issues/10)
 * But, there are also a lot of filter functions added in this version, so until
   then you can do something like this in your theme’s functions.php to choose which
   custom post type you want.
 *     ```wp-block-code
       function filter_wzpa_query_where( $where ) {
       	global $wpdb;
   
       	$posts_table = $wpdb->get_blog_prefix() . 'posts';
   
       	$where .= " AND {$posts_table}.post_type = 'post' ";
       	return $where;
       }
       add_filter( 'wzpa_query_where', 'filter_wzpa_query_where' );
       ```
   
 *  Thread Starter [Morshed Alam](https://wordpress.org/support/users/sumon1068/)
 * (@sumon1068)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/feature-request-989/#post-16983611)
 * Excellent! This works fine.
 * Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Feature Request’ is closed to new replies.

 * ![](https://ps.w.org/popular-authors/assets/icon-256x256.png?rev=2953493)
 * [Popular Authors](https://wordpress.org/plugins/popular-authors/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/popular-authors/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/popular-authors/)
 * [Active Topics](https://wordpress.org/support/plugin/popular-authors/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/popular-authors/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/popular-authors/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Morshed Alam](https://wordpress.org/support/users/sumon1068/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/feature-request-989/#post-16983611)
 * Status: resolved