hi , i need to use the Authors Box in the footer but its critical to limit the list to 3 authors, sorted by post count.
could someone suggest how to do it?
thank you )
Hi
This can be achieved only by editing the code which generate the author box. Replace the code from td_block_authors.php with this one: http://screencast.com/t/smtjtqQKGJ – http://pastebin.com/XaLKJKvN – http://screencast.com/t/iZ6y4bwNF
Also you have to set the authors by to display authors by post count in Visual Composer or in widgets area: http://screencast.com/t/zonMc9T2Zb Note that by editing the indicated file author box will display only three authors on entire site.
Before making any changes make sure you do a full backup to your current wp-install.
Hope this helps.
Thanks!
Hi Andrei
Note that by editing the indicated file author box will display only three authors on entire site.
How to change the code if I want to display ten (Top-10) authors (authors by post count)?
This file td_block_authors.php can i use in Child Theme?
Sorry for my poor English.
Thanks!
Hi
You just need to increase this value: http://screencast.com/t/VNOw2EFRskm
Yes you can edit that file n child theme and for more detail in this regard please check this link: https://forum.tagdiv.com/the-child-theme-support-tutorial/
Thanks!
Hi, i did this, worked fine…
there is any way to show random authors?
Hello mauro_boaro,
Sorry but the theme does not have any other way for this, sorry! If you want to achieve this you should edit the theme core files and do this from there. Also, if you are not aware of the steps which are needed to take in this case, please consider hiring a freelancer/developer to help you because we cannot provide custom services at the moment, sorry!
Thanks for the message!
I needed to limit the number of authors to display and sort them randomly. It would be nice if it was included as a feature.
I share the code modifications I have made in case they serve as a starting point or serve for someone with the same need.
Enabling order by rand to functions.php
td-composer/legacy/Newspaper/includes/shortcodes/td_block_authors.php
@@ -175,7 +175,8 @@ class td_block_authors extends td_block {
'roles' => '',
'sort' => '',
'exclude' => '',
- 'include' => ''
+ 'include' => '',
+ 'number' => '',
), $atts));
@@ -200,7 +201,7 @@ class td_block_authors extends td_block {
$get_users_array['orderby'] = 'display_name';
//$td_authors = get_users(array('orderby' => 'display_name'));
} else {
- $get_users_array['orderby'] = 'post_count';
+ $get_users_array['orderby'] = $sort;
$get_users_array['order'] = 'DESC';
//$td_authors = get_users(array('orderby' => 'post_count', 'order' => 'DESC'));
}
@@ -216,6 +217,10 @@ class td_block_authors extends td_block {
$get_users_array['role__in'] = $roles_in;
}
+ if (!empty($number)) {
+ $get_users_array['number'] = $number;
+ }
+
$td_authors = get_users($get_users_array);
td-composer/legacy/Newspaper/includes/td_config.php
@@ -30387,7 +30387,7 @@ class td_config {
array(
"param_name" => "sort",
"type" => "dropdown",
- "value" => array('- Sort by name -' => '', 'Sort by post count' => 'post_count'),
+ "value" => array('- Sort by name -' => '', 'Sort by post count' => 'post_count', 'Random' => 'rand'),
"heading" => 'Sort authors by:',
"description" => "",
"holder" => "div",
@@ -30411,6 +30411,15 @@ class td_config {
"holder" => "div",
"class" => "tdc-textfield-big",
),
+ array(
+ "param_name" => "number",
+ "type" => "textfield",
+ "value" => '',
+ "heading" => "Number of users to limit",
+ "description" => "",
+ "holder" => "div",
+ "class" => "tdc-textfield-big",
+ ),
array(
"param_name" => "separator",
"type" => "horizontal_separator",
Hello,
Unfortunately, there were only a few improvements that have been added in this theme update – https://tagdiv.com/newsmag/?utm_source=forum&utm_medium=menu&utm_campaign=forum_loggedin&utm_content=52878
Thank you!
