Search result page as a new page

You can use custom template for search page: <?php get_header(); ?> <section id=”primary” class=”content-area”> <div id=”content” class=”site-content” role=”main”> <?php if ( have_posts() ) : ?> <header class=”page-header”> <h1 class=”page-title”><?php printf( __( ‘Search Results for: %s’, ‘shape’ ), ‘<span>’ . get_search_query() . ‘</span>’ ); ?></h1> </header><!– .page-header –> <?php shape_content_nav( ‘nav-above’ ); ?> <?php /* Start … Read more

Adding custom search button to menu

This code is from the full-screen-search.js file of the plugin in which replace the selector of search input and button with your font awesome button selector as shown below: jQuery( document ).ready( function( $ ) { // … display the Full Screen search when user clicks the font awesome button $( ‘<font awesome button selector>’ … Read more

Replacing wordpress search with custom code

Sorry about my english. I think you must use the build-in query hook to send your posts ids to the main query. It use the pre_get_posts hook. That will allow you to change the query after it’s creation, and before it’s execution. add_action(‘pre_get_posts’, ‘my_search_query’); function my_search_query($query) { if($query->is_search() && $query->is_main_query() && get_query_var(‘s’, false)) { // … Read more

Partial searches for wp_usermeta

<?php // ALWAYS sanitize user input! $poblacion = sanitize_text_field( $_GET[‘poblacion’] ); $trabajo = sanitize_text_field( $_GET[‘trabajo’] ); $usuarios = get_users( array( ‘role’ => ’empresa-BBDD’, ‘order_by’ => ‘nicename’, ‘order’ => ‘ASC’, ‘meta_query’ => array( // search for user meta data ‘relation’ => ‘AND’, array( ‘key’ => ‘poblacion’, ‘value’ => $poblacion, ‘compare’ => ‘LIKE’ // partial comparison ), … Read more

Highlight search words in excerpt

Use str_replace to replace all occurances of the word to highlight with a around the word. Something like // $searchresult = result of search process, //$highlightword = word you want to highlight $searchresult = str_replace( $highlightword, “<span style=”background-color:#ffff00;”>$highlightword</span>”, $searchresult ); Adjust the background-color to what you want to use. To limit the number of words … Read more