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

Order & Orderby clause not working with custom query

Sorting your posts by relevance. The code below will output the posts ordered by relevance I have added some comments for some clarification let me know if it works. function my_custom_query(){ // get only the posts without order them $my_query_posts = new WP_Query( array( ‘numberposts’ => 5 ) ); // check relevance posts foreach( $my_query_posts->posts … Read more

How do I remove search bar that isn’t a widget?

You can that by css : Appearance -> Customize -> Additional CSS Paste this code AFTER all the contents .main-navigation .menu-item-search { display: none; } Save You can also do that by adding this code of line in the bottom most part of the functions. Login to Dashboard Go to Appearance -> Editor Click Theme … Read more