New answers tagged

0

I don't think http and https would have matter, https is like a standard nowadays, in order to check properly, please try the following: Check your image link and make sure it is working Visit this FB debugger page - https://developers.facebook.com/tools/debug/ and check if something else is wrong.


0

You are missing the name attribute. you just need to add it to your input field like this <input type="text" id="s" name="s" placeholder="Search" class="search-field"> Any input field is meant to take data for query, the name attribute is mandatory.


0

Here is the code from the provided link after adaptation. add_filter( 'posts_orderby', 'se344727_custom_search_order', 10, 2 ); function se344727_custom_search_order( $orderby, $query ) { global $wpdb; if (!is_admin() && $query->is_main_query()) { if ($query->is_search) { // -- sort by: type, title, ...


0

This works perfectly for me on my site: nnn.com.ng. Other solution throw a 404 error for me. /** * initiate a change of the wordpress default search page slug to the new search page slug. */ add_action( 'init', 'dsfs' ); function dsfs() { $GLOBALS['wp_rewrite']->search_base = '%your_search_string%'; } /** * redirect default search page slug to the ...


1

According to the documentation, the only required files in a theme are style.css and index.php. All other files are optional. You can use the ones you need and discard the ones you don't need. If you haven't seen it, I'd recommend you check out WordPress's developer site on the topic of themes.


0

You could hook into WordPress' pre_get_posts action by adding the following code to your themes functions.php file. add_action( 'pre_get_posts', 'wp070819_wcresults_only' ); function wp070819_wcresults_only( $query ) { if( ! is_admin() && is_search() && $query->is_main_query() ) { $query->set( 'post_type', 'product' ); } } I ...


0

You can search from the products only by changing the post_type listings to products from the query on the search results page.


0

$name = 'John Doe'; // Split $name $name = preg_split( '/\s+/', trim( $name ) ); // Set first name $first_name = $name[0]; // Last name was provided? $last_name = isset( $name[1] ) ? $name[1] : null; // Define meta query args array $meta_query_args = array(); // Set "first name" meta query or "first name" + "last name" if both exist if ( is_null( $...


1

There are better ways, but one easy way to achieve this if you wanted to customise the search results is to edit the search.php template and make the WP_Query a custom one: <?php $args = array( 's' => get_search_query(), 'post_type' => array('page'), ); $search_query = new WP_Query($args); if ( have_posts() ) : while ( $search_query-&...


1

I just need to be able to spit out the term as a result itself, with a link to the term (and be counted in the search count query). So if a search matches a taxonomy term that should come first, followed by the other results in whatever order. WP_Query::$posts are WP_Post objects and can't include (or be mixed with) term/WP_Term objects. However, ...


Top 50 recent answers are included