Thanks Bettina. I will wait for the solution.
I do not think so. The box only ever randomizes the first 3 authors and should show 3 authors randomly.
For example:
Authors: A, B, C, D, E
Current: A,C,B – A,B,C – C,B,A
Expected: A,E,B – A,C,B – E,B,A
Great, thanks. Only to clarify. This would be a Newspaper feature.
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.
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.
tagdiv CSS Analyzer is not active
I’m not sure if I was clear with explanation. Two search links to illustrate the issue:
(normal) https://blog.cristianismeijusticia.net/?s=cine
(unstyled) https://blog.cristianismeijusticia.net/?s=jhgjghhg
I can’t see how edit that page. Search results are dynamic.
I having a similar issue in searches without results and with categories without posts. Anamaria do you know anything else about this problem? Is there any other way to fix it than uninstalling the plugin and reinstalling it? Isn’t it risky to uninstall the plugin?
I also want to hide the number of comments indicator. It would be desirable that it could be configured at the block level. From what I’ve seen at code level it’s not possible “td-composer/legacy/Newspaper/includes/shortcodes/td_block_authors.php”.
I ask for this feature to add to this other one https://forum.tagdiv.com/topic/authors-boxwidgets-how-to-limit-the-authors-list/#post-398911. In terms of performance it could also be beneficial.
-
This reply was modified 5 years by
fespinal.
Thanks Calin. Please consider including this functionality, maintaining these changes for each new version will be a “heavy” task.
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",
