Authors box(widgets) how to limit the authors list?

Posted in: Newsmag
Post count: 1

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 )

Post count: 6535

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/smtjtqQKGJhttp://pastebin.com/XaLKJKvNhttp://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!

Post count: 1341

Hi Andrei

http://pastebin.com/XaLKJKvN

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!

Post count: 6535

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!

Post count: 6

Hi, i did this, worked fine…

there is any way to show random authors?

Post count: 23312

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!

Post count: 12

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",

Post count: 35449

Hi fespinal,
Thank you for sharing with us the solution that you founded for limit the number of authors to display and sort them randomly.
Thank you!

Post count: 12

Thanks Calin. Please consider including this functionality, maintaining these changes for each new version will be a “heavy” task.

Post count: 35449

I added on our suggestion list to improved the theme elements.
Thank you!

Post count: 12

Has there been any progress in this direction? The proposed code is very simple, and the improvement can be very useful for all theme users.

Post count: 35449

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!

Post count: 12

But are you considering adding it? I insist the development is simple, it is done and it would be easy to incorporate in a future version.

Post count: 35449

Hi,
Yes, this is on our list for request from users.
The thing is, in Newsmag most theme updates are done for security, not to bring new features.
Thank you for your understanding!

Post count: 12

Great, thanks. Only to clarify. This would be a Newspaper feature.

Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic.