Support » Plugin: Gwolle Guestbook » New entries – last

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marcel Pol

    (@mpol)

    If you mean, change the sort order from DESC to ASC, sure, this will do that:

    function my_asc_gwolle_gb_get_entries_sql( $sql, $sql_nonprepared, $values, $args ) {
    
    	global $wpdb;
    
    	if ( is_admin() ) {
    		return $sql;
    	}
    
    	$old = 'DESC';
    	$new = 'ASC';
    	$sql_nonprepared = str_replace( $old, $new, $sql_nonprepared );
    	// Always use $wpdb->prepare(), no exceptions.
    	$sql = $wpdb->prepare( $sql_nonprepared, $values );
    
    	return $sql;
    
    }
    add_filter( 'gwolle_gb_get_entries_sql', 'my_asc_gwolle_gb_get_entries_sql', 10, 4 );

    This will change it for all frontend code, including widgets.
    You can have this code in functions.php of your theme, preferably in a child theme.

    Thread Starter jelenaxxy

    (@jelenaxxy)

    Hey, sorry for late reply.

    Thank you for your help. I pasted the entire code in my functions.php, and nothing happened.

    I pasted is here, that is right place, right? https://prnt.sc/148tsrt

    Thank you in advanced for your answer.

    Jelena

    Plugin Author Marcel Pol

    (@mpol)

    Hi Jelena,

    Ah, sorry, that won’t work ๐Ÿ™‚

    That is a stylesheet for the theme. It is meant for layout and styling, like colors, fonts, anything. This file will also be overwritten on an update.

    The file in the theme that you are looking for is functions.php. That is about php code and functionality. Sort ordering is part of functionality, not styling or colors ๐Ÿ™‚

    Also, this functions.php file will also be overwritten on an update, you are better off using a Child Theme:
    https://learn.wordpress.org/lesson-plan/child-themes/

    There are plugins that can easily help you create a child theme:
    https://wordpress.org/plugins/search/child+theme/

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.