Search Result Custom Order

1 year ago

< 1 min read

Posted by:

Focus

Subscribe to newsletter

By subscribing you agree to with our Privacy Policy.

Share

To add this code, go to Dashboard > Appearance > Theme File Editor and add one of these codes at the bottom of function.php.

BY DATE DESC

This one to show the latest posts first.

remove_filter( 'posts_search_orderby');
add_filter( 'posts_search_orderby');
function rl_posts_search_orderby( $orderby, $query ) {
	if ( isset( $query->query['s'] ) ) {
		$orderby = 'post_date DESC';
	}
	return $orderby;
}

RANDOM ORDER

add_filter( 'pre_get_posts', 'enfold_customization_random_search' );
function enfold_customization_random_search( $q ) {
	if ( $q->is_search ) { $q->set( 'orderby', 'rand' ); }
	return $q;
}

Read more

Breakpoints

< 1 min read

Disable Zoom on Mobile Devices (native App Style)

Go to Dashboard > Elementor > Custom Code > Add New Code. This code will disable the abilty to zoom

Read more

Woocommerce

< 1 min read

Disable Billing Address

Simplify checkout for virtual products or order via WhatsApp. Add this code in function.php. CODE PHP

Read more

Global

2 min read

Disabling the Device’s Default ‘Dark Mode’ in WordPress

If you are trying to convert your WordPress website to APK / AAB, you may need to disable the device’s

Read more

Image

< 1 min read

Crop Image To Ratio

To crop image based on ratio, on Elementor’s Image Widget add this CSS: 16:9 Landscape CSS 9:16 Portrait CSS

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, January 15

Hi, there 👋

How can I help you?

Start Chat with:

We use cookie to improve your experience on our site. By using our site you consent cookies.