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

Header

< 1 min read

Header Padding: Conditional HTML

If you want to have conditional padding for your header, give your header the CSS class .mainheader and add an

Read more

Container

< 1 min read

Make Container Scrollable

Add this on the column’s custom CSS panel. Adjust the ‘max-height’ to your needs.

Read more

Global

< 1 min read

Additional CSS on WordPress Customization

To improve your site a bit, add this basic CSS to each one you create. Customizing the scroll bar, the

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, February 12

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.