Employees Carousel random order

Hello,

First I tried to give the employees carousel a auto slide. The script I did find ont his formum did t he trick…

Then I tried to accomplish to get the Employees carousel showing the people in random order. I did read on the form 2 threats…

This one: link 1
And This one: link 2

According to that topics my child theme functions should look like this:

    <?php
/**
 * Sydney child functions
 *
 */


/**
 * Enqueues the parent stylesheet. Do not remove this function.
 *
 */
add_action( 'wp_enqueue_scripts', 'sydney_pro_child_enqueue' );
function sydney_pro_child_enqueue() {
    
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}

/* ADD YOUR CUSTOM FUNCTIONS BELOW */

/*
 * Requiring employee widget file from childtheme
 */
require get_stylesheet_directory() . "/widgets/fp-employees.php";

/*
 * Unregistering default employee widget
 */
function sydney_child_remove_employees_widget() {
	unregister_widget('Sydney_Employees');
}
add_action( 'widgets_init', 'sydney_child_remove_employees_widget', 999 );

/*
 * Registering new widget
 */
function sydney_child_register_new_widget(){
  register_widget( 'Sydney_Child_Employees' ); // Widget class name
}
add_action( 'widgets_init', 'sydney_child_register_new_widget' );

And the file fp-employees.php in the widget folder of my child theme did get 2 changes…

I changed the line3 into:

class Sydney_Child_Employees extends WP_Widget

and the part at line 79 I added orderby.

$r = new WP_Query(array(
			'no_found_rows'       => true,
			'post_status'         => 'publish',
			'post_type' 		  => 'employees',
			'posts_per_page'	  => $number,
			'category_name'		  => $category,
                     'orderby'  => 'rand'			
		) );

I get no errors, the widget is still working… bur… it is not random. So, what do i do wrong oe what do I forget?

Sorry for any bad english

Regards Jap

Hello Jap,

Can you please provide a link to your website?

Kind Regards, Roman.
aThemes Support