This is a bit of a broad question and I don’t have time to hash out the whole thing, but your search code needs to modify the query something very much like:
add_action(
'pre_get_posts',
function ($qry) {
if ($qry->is_search()) {
$qry->set('orderby','title');
}
}
);
I have a feeling a lot of details are missing from the question though.
Related Posts:
- How to remove search bar from a wordpress theme? [closed]
- wp_enqueue_scripts not called on search page?
- How can I customize wp_footer, where is the code that controls what this function does?
- Implement advanced search
- Why is the post type on the search result page random?
- Non-Blog Website without Search: are comments.php and search.php in theme still required?
- Custom WordPress Theme – Search not working on posts
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- WordPress Filtering Custom Post Type by Metadata and Search Heirachy
- Post and page content not displaying in search results
- Valid SQL query not returning results
- $_POSTing to and modifying the WP search results page
- Custom theme won’t use search.php
- Search Form Not Working
- altering search terms
- Custom search template is showing 404 when adding query string
- Woocommerce AJAX filters option loading spiner – problem on mobile device
- Why not works the search.php file?
- Is it possible to show sort page excerpt in search.php
- New theme HTML5 Support for Search in WordPress 4.4
- Incorrect search results in search.php – issue triggered by using `define(‘BodyID’, ‘search’); the_post();` in search.php
- The normal loop with different styles doesn’t work in search.php
- Search Results not displaying for multiple word search
- custom theme’s search not working
- How to add posts to custom menus?
- How to add custom css file in theme?
- How to: Update live sites theme from version control repo via plugin or library? [closed]
- Best practice way to implement custom sections into a WordPress theme
- Adding items to page template dropdown on Page Edit Screen
- How to customize wordpress login/register pages?
- Page attribute template dropdown not displayed even the syntax is correct
- How to add a text widget during theme activation
- WordPress Theme customisation CSS
- Why does this loop only work on the homepage?
- Nesting Functions within Functions
- De-registering parent style sheet css recommended?
- inserting custom li class to wp_list_pages
- Theme check: Missing a text-domain
- Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?
- How to determine if post has widget content?
- Custom Script Section Only Echoes Text
- Free starter theme to make mobile websites? [closed]
- WP Customize refresh problem
- Set multiple templates per post
- Place the page title into the short code
- My javascript jquery won’t work?
- Displaying recent post excerpts on static front page
- How to check if a WordPress core block is active in sidebar
- approach to pass additional parameter in post URL
- Folder name for a pro version of a WordPress.org theme?
- WordPress Media Uploader in page template (On Front-end)
- Using WordPress’ Theme Customizer to select page templates that update layout in the preview
- Theme Customizer not loading JS for live preview
- Replace function in a child theme
- get_search_form() and aria_label
- Can’t remove DIV from hooks in Storefront child theme [closed]
- How to register and enqueue JavaScript files without breaking plugin dependencies?
- How can I specify that an area of my theme contains widgets?
- Extract all shortcode data from post into loop variables?
- wp_nav_menu and its fallback
- Adding the_content() return warning count()
- Copying the theme style files and images to duplicate the website but with a difference
- How to enqueue a script which is type module without using script_loader_tag filter?
- How to set Post meta-box defaults based on the choices made by user in Customizer?
- How do I include a partial from a directory below a wordpress theme directory?
- Ajax call returns 0 when add_action is inside a class in functions.php
- Woocommerce Product attribute not imported with wordpress Importer [closed]
- Search page results conflicting logic – Search result caching?
- WordPress Comment spam issue
- Is it possible to have a Theme with built-in physical page files?
- header, stylesheet not being read
- first excerpt fine, subsequent post excerpts shift to the right instead of displaying vertically [closed]
- questions of submit wordpress theme [duplicate]
- List categories of a post hierarchically?
- Custom Post Types set up, how do I style the main slug page?
- What are the permalinks options for “Category” base and removing it?
- Designing a custom archive.php inspired by the Autofocus theme
- Is a site with 1,500 pages, (1000 of which are E-Commerce Pages) Too Big to Migrate to WordPress?
- How to add wysiwyg editor in customize screen using customize_register
- How to register dynamic settings in WordPress Customizer?
- How to add audio files to audio player in WordPress custom theme?
- Data Validation & Sanitization for Big HTML Blocks
- Using ‘get_template_directory_uri’ correctly
- Customizer API way function is_customize_preview() works only in main page?
- Advantages/Disadvantages Using Theme Editor Instead of Pages
- Magnific Popup – Add Caption to Images
- Why do WordPress developers use so many opening and closing PHP tags when developing themes? [duplicate]
- using theme check plugin to remove waring and errors from my theme
- paragraph format in WYSIWYG on a custom theme?
- unable to display the image meta value as background
- editor style css and page template with and without sidebar
- 3 x 3 grid of posts on the home page
- Suppress the_content filter in a nested loop
- Pass custom css class to add_menu_page
- URL conflict with a ‘Single Page Layout’
- loading custom.js file after jquery is loaded
- How to force unlink on attached/inserted images?
- How to determine if it is legal to remove credit link from theme?
- Display recent posts on front page
- How to create sub-menu in “Allure Real Estate Theme for Placester”?