Search Result Custom Order

9 months 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

Single Post

2 min read

Hiding “Previous Post” Navigation in Elementor with Custom CSS

Hi, there! I’ll share some quick tips on how to change the appearance of article navigation on your Elementor website. We’ll

Read more

Video

< 1 min read

Elementor Custom Video Lightbox CSS

Add this code on Appearance Customize > Additional CSS :

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

Post Widget

2 min read

How to Make Post Widget’s White Space Clickable (+Popup)

Go to Dashboard > Elementor > Custom Code. And then add this code to make the whole space/box/card of the

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, July 27

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.