Hi,
Thank you for your response. Thank you for pointing the issue.
While going through the child theme we found below functions that were causing issues.
1.Below function is used to Sort the products in “out of stock” at the end of the page. This function is important for us as “In Stock” products were prioritized and were displayed at the top of products list.
//Sort the products in “out of stock” at the end of the page
add_filter('posts_clauses', 'order_by_stock_status');
function order_by_stock_status($posts_clauses) {
global $wpdb;
// only change query on WooCommerce loops
if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) {
$posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) ";
$posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby'];
$posts_clauses['where'] = " AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where'];
}
return $posts_clauses;
}
This was working well in the PRO 5.1.5 with custom Header and Footer. Is there any suggestion in which we can Sort the products in “out of stock” at the end of the page.
It’s true, we have a layout assigned for specific product categories and tags only.
2.Regarding Search Result Layout:
Below is the function taken from ACF forum and it was too working at PRO 5.1.5 with Custom Header and Footer. This was used to extend WordPress Search results to include ACF fields in search results. This function was too creating the issue with custom Header and Footer at the Search Result page.
//Extend WordPress search to include custom fields
function cf_search_join( $join ) {
global $wpdb;
if ( is_search() ) {
$join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';
}
return $join;
}
add_filter('posts_join', 'cf_search_join' );
//Modify the search query with posts_where
function cf_search_where( $where ) {
global $pagenow, $wpdb;
if ( is_search() ) {
$where = preg_replace(
"/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
"(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_value LIKE $1)", $where );
}
return $where;
}
add_filter( 'posts_where', 'cf_search_where' );
//Prevent duplicates
function cf_search_distinct( $where ) {
global $wpdb;
if ( is_search() ) {
return "DISTINCT";
}
return $where;
}
add_filter( 'posts_distinct', 'cf_search_distinct' );
Is there any suggestion in which we can Extend WordPress search to include custom ACF fields.
3.Brands (Pee Safe)
We have Custom Header for the Brand Page named (Pee Safe). We think the condition is well applied. Even tough of this, it is not getting displayed (implemented) at this particular page. We have checked with the child theme, there is no issues regarding brands. It was too working at PRO 5.1.5 with Custom Header.
You can see via below link:
https://www.hamroshringar.com/product-brands/pee-safe/
Hoping for the solutions.
Thank You,
Bibhash Karn