Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Youzify

    (@youzify)

    Hello @webmark487,

    Thanks for reaching us!

    You can use this snippet below to achieve that ??

    <?php
    /**
     * Select Alphabet on Select Box.
     */
    function yzc_make_alphabet_selected() {
    
        ?>
        <script type="text/javascript">
    
        ( function( $ ) {
    
        $( document ).ready( function() {
            jQuery( '#members-order-by option[value="alphabetical"], #groups-order-by option[value="alphabetical"]' ).attr( 'selected', true );
        });
    
        })( jQuery );
        </script>
        <?php
    
    }
    add_action( 'wp_footer', 'yzc_make_alphabet_selected' );
    
    /**
     * Members Directory - Set Default Filter.
     */
    function yzc_set_default_members_directory_filter( $loop ) {
    
        if ( bp_is_members_directory() && ! isset( $_POST['filter'] ) ) {
            $loop['type'] = 'alphabetical';
        }
    
        return $loop;
    
    }
    
    add_filter( 'bp_after_has_members_parse_args', 'yzc_set_default_members_directory_filter', 9999 );
    
    /**
     * Members Directory - Set Default Filter.
     */
    function yzc_set_default_groups_directory_filter( $loop ) {
    
        if ( bp_is_groups_directory() && ! isset( $_POST['filter'] ) ) {
            $loop['type'] = 'alphabetical';
        }
    
        return $loop;
    
    }
    
    add_filter( 'bp_after_has_groups_parse_args', 'yzc_set_default_groups_directory_filter', 9999 );

    Let us know if it worked fine for you!

    Best Regards.

    Thread Starter webmark487

    (@webmark487)

    it worked (i added it to the functions.php in my child theme).

    the only thing i am a little confused about – even if i deactivate Youzify plugin, i still get a search result with sort order-drop down …

    isn′t that a Youzify functionality?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change default order by?’ is closed to new replies.